From 7df171f59a20c5a65f56dd1954b96aa8dc3776ae Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 6 Nov 2020 20:56:02 -0500 Subject: [PATCH] nhrpd: Fix memory leak on shutdown On shutdown we were blantantly dropping the node->info data. Make it happy. Signed-off-by: Donald Sharp --- nhrpd/nhrp_route.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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]); } -- 2.39.5