summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-10-16 12:40:01 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2024-10-16 13:30:25 +0200
commit74b9f0ae748ae6676083606f9ab5cd45ec2c64b6 (patch)
tree076ada5a1c5d83fc43e6e4683c8969f40082a437
parent4a3843e8d298299cd5527f8dbdbbc61da6b34c9d (diff)
ldpd: free previous config if it wasn't applied
If a create-config command is received, but the config is never applied, the config will be leaked on the next create-config command. This should theoretically never happen, but let's fix it anyway. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--ldpd/ldpe.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c
index 6e844c0aa1..0a3a03bc38 100644
--- a/ldpd/ldpe.c
+++ b/ldpd/ldpe.c
@@ -459,6 +459,8 @@ static void ldpe_dispatch_main(struct event *thread)
tnbr_update_all(AF_UNSPEC);
break;
case IMSG_RECONF_CONF:
+ if (nconf)
+ ldp_clear_config(nconf);
if ((nconf = malloc(sizeof(struct ldpd_conf))) == NULL)
fatal(NULL);
memcpy(nconf, imsg.data, sizeof(struct ldpd_conf));