Skip to content

Commit

Permalink
Fix memory leak of console_binding_addr
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviojs committed Mar 10, 2024
1 parent c71df25 commit 110d3f2
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 110d3f2

Please sign in to comment.