summaryrefslogtreecommitdiffstats
path: root/nhrpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-11-07 02:56:02 +0100
committerDonald Sharp <sharpd@nvidia.com>2020-11-07 02:56:02 +0100
commit7df171f59a20c5a65f56dd1954b96aa8dc3776ae (patch)
treebb739ce5b6946b0197058f2d83ab7c4c26dda8b7 /nhrpd
parentMerge pull request #7473 from eololab/fix-crash-bfdd-show-counters-json (diff)
downloadfrr-7df171f59a20c5a65f56dd1954b96aa8dc3776ae.tar.xz
frr-7df171f59a20c5a65f56dd1954b96aa8dc3776ae.zip
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>
Diffstat (limited to 'nhrpd')
-rw-r--r--nhrpd/nhrp_route.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c
index 2bc2d9159..e7d35b90f 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]);
}