diff options
author | Donald Sharp <sharpd@nvidia.com> | 2022-12-03 13:16:36 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2022-12-05 14:50:24 +0100 |
commit | ab914252662209d1218c709d2efbf630962f930c (patch) | |
tree | 1177ba2ec91c74432993fbf2e232e25e593fc1da | |
parent | zebra: Cleanup use after free in shutdown (diff) | |
download | frr-ab914252662209d1218c709d2efbf630962f930c.tar.xz frr-ab914252662209d1218c709d2efbf630962f930c.zip |
vtysh: Cleanup memory leak
When multiple daemons report a exit line for the same
node, vtysh was just dropping the previous pointer.
Ensure that we free it first.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r-- | vtysh/vtysh_config.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index ac0cdc6ff..ac32f0a77 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -348,9 +348,13 @@ void vtysh_config_parse_line(void *arg, const char *line) break; default: if (strncmp(line, "exit", strlen("exit")) == 0) { - if (config) + if (config) { + if (config->exit) + XFREE(MTYPE_VTYSH_CONFIG_LINE, + config->exit); config->exit = XSTRDUP(MTYPE_VTYSH_CONFIG_LINE, line); + } } else if (strncmp(line, "interface", strlen("interface")) == 0) config = config_get(INTERFACE_NODE, line); else if (strncmp(line, "pseudowire", strlen("pseudowire")) == 0) |