From 11c9ab3202b2cefca0daca2ca1883e6772524a73 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Thu, 14 Jul 2022 12:20:01 -0400 Subject: [PATCH] zebra: free neighbor state before exit to avoid memleaks Signed-off-by: Christian Hopps --- zebra/zebra_neigh.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zebra/zebra_neigh.c b/zebra/zebra_neigh.c index 2fca2a0615..09e9a62f68 100644 --- a/zebra/zebra_neigh.c +++ b/zebra/zebra_neigh.c @@ -272,8 +272,13 @@ void zebra_neigh_init(void) void zebra_neigh_terminate(void) { + struct zebra_neigh_ent *n, *next; + if (!zrouter.neigh_info) return; + RB_FOREACH_SAFE (n, zebra_neigh_rb_head, &zneigh_info->neigh_rb_tree, + next) + zebra_neigh_free(n); XFREE(MTYPE_ZNEIGH_INFO, zneigh_info); } -- 2.39.5