From: Donald Sharp Date: Sat, 7 Nov 2020 01:56:02 +0000 (-0500) Subject: nhrpd: Fix memory leak on shutdown X-Git-Tag: frr-7.5.1~33^2~20 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=4fd5e5d7db8f2512d3c6fcf09122d68fdb9e8b12;p=mirror%2Ffrr.git nhrpd: Fix memory leak on shutdown On shutdown we were blantantly dropping the node->info data. Make it happy. Signed-off-by: Donald Sharp --- diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index 0c5513b892..bbb2b0d622 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -355,10 +355,22 @@ void nhrp_zebra_init(void) zclient_init(zclient, ZEBRA_ROUTE_NHRP, 0, &nhrpd_privs); } +static void nhrp_table_node_cleanup(struct route_table *table, + struct route_node *node) +{ + if (!node->info) + return; + + XFREE(MTYPE_NHRP_ROUTE, node->info); +} + void nhrp_zebra_terminate(void) { zclient_stop(zclient); zclient_free(zclient); + + zebra_rib[AFI_IP]->cleanup = nhrp_table_node_cleanup; + zebra_rib[AFI_IP6]->cleanup = nhrp_table_node_cleanup; route_table_finish(zebra_rib[AFI_IP]); route_table_finish(zebra_rib[AFI_IP6]); }