From 3d1f0c467b3d8cd9c7cb0fd3ea81165748ee8af0 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 11 Dec 2023 15:44:26 -0500 Subject: [PATCH] zebra: On shutdown properly free up ns memory Signed-off-by: Donald Sharp --- lib/netns_linux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/netns_linux.c b/lib/netns_linux.c index 297e2c5952df..bebb5c1f777b 100644 --- a/lib/netns_linux.c +++ b/lib/netns_linux.c @@ -502,12 +502,19 @@ void ns_init_management(ns_id_t default_ns_id, ns_id_t internal_ns) void ns_terminate(void) { struct ns *ns; + struct ns_map_nsid *ns_map; while (!RB_EMPTY(ns_head, &ns_tree)) { ns = RB_ROOT(ns_head, &ns_tree); ns_delete(ns); } + + while (!RB_EMPTY(ns_map_nsid_head, &ns_map_nsid_list)) { + ns_map = RB_ROOT(ns_map_nsid_head, &ns_map_nsid_list); + RB_REMOVE(ns_map_nsid_head, &ns_map_nsid_list, ns_map); + XFREE(MTYPE_NS, ns_map); + } } int ns_switch_to_netns(const char *name)