From: Donald Sharp Date: Sat, 7 Nov 2020 01:56:02 +0000 (-0500) Subject: nhrpd: Fix memory leak on shutdown X-Git-Tag: base_7.6~298^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7df171f59a20c5a65f56dd1954b96aa8dc3776ae;p=matthieu%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 2bc2d91597..e7d35b90ff 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -350,10 +350,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]); }