nhrpd: Fix memory leak on shutdown

On shutdown we were blantantly dropping the node->info
data.  Make it happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2020-11-06 20:56:02 -05:00
parent 3bb43118ec
commit 7df171f59a

View File

@ -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]);
}