]> git.puffer.fish Git - matthieu/frr.git/commitdiff
nhrpd: Fix memory leak on shutdown
authorDonald Sharp <sharpd@nvidia.com>
Sat, 7 Nov 2020 01:56:02 +0000 (20:56 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Sat, 7 Nov 2020 01:56:02 +0000 (20:56 -0500)
On shutdown we were blantantly dropping the node->info
data.  Make it happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
nhrpd/nhrp_route.c

index 2bc2d91597c681a2f873ea573f6ff480d91443ee..e7d35b90ff05e12870d54afa29747e9047a55adf 100644 (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]);
 }