Skip to content

Commit

Permalink
Fix code bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Iam-WenYi committed Aug 25, 2024
1 parent 025fdb6 commit b69ee36
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pikiwidb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,18 @@ bool PikiwiDB::ParseArgs(int argc, char* argv[]) {
break;
}
case 's': {
master_.resize(strlen(optarg));
sscanf(optarg, "%s:%d", master_, master_port_);
unsigned int optarg_long = strlen(optarg);
char *str = calloc(optarg_long, sizeof(char*));
if (str)
{
sscanf(optarg, "%s:%d", str, master_port_);
master_ = str;
free(str);
}
else
{
ERROR("Memory alloc failed.");
}
break;
}
case '?': {
Expand Down

0 comments on commit b69ee36

Please sign in to comment.