From 110d3f234aa35ccceeaf27529390e73a4135e095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20J=2E=20Saraiva?= Date: Sun, 10 Mar 2024 18:57:18 +0000 Subject: [PATCH] Fix memory leak of console_binding_addr --- common/dynamips.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/dynamips.c b/common/dynamips.c index 05b6348d9..15fee6899 100644 --- a/common/dynamips.c +++ b/common/dynamips.c @@ -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; @@ -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;