Skip to content

Commit

Permalink
Merge pull request #156 from flaviojs/fix-memory-leak-console_binding…
Browse files Browse the repository at this point in the history
…_addr

Fix memory leak of console_binding_addr
  • Loading branch information
grossmj authored Mar 10, 2024
2 parents c71df25 + 110d3f2 commit 0ec9f78
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/dynamips.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,9 @@ static int parse_std_cmd_line(int argc,char *argv[])

/* Global console (vtty tcp) binding address */
case OPT_CONSOLE_BINDING_ADDR:
if (console_binding_addr) {
free(console_binding_addr);
}
console_binding_addr = strdup(optarg);
printf("Console binding address set to %s\n", console_binding_addr);
break;
Expand Down Expand Up @@ -828,6 +831,9 @@ static int run_hypervisor(int argc,char *argv[])

/* Global console (vtty tcp) binding address */
case OPT_CONSOLE_BINDING_ADDR:
if (console_binding_addr) {
free(console_binding_addr);
}
console_binding_addr = strdup(optarg);
printf("Console binding address set to %s\n", console_binding_addr);
break;
Expand Down

0 comments on commit 0ec9f78

Please sign in to comment.