]> git.puffer.fish Git - mirror/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)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 17 Nov 2020 18:07:58 +0000 (21:07 +0300)
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 0c5513b89297c4a63a02fd0655985f65361878a9..bbb2b0d6227f9cc2c6b5b8d5793c6c18409f701b 100644 (file)
@@ -355,10 +355,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]);
 }