Skip to content

Commit

Permalink
zebra: On shutdown properly free up ns memory
Browse files Browse the repository at this point in the history
Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Dec 11, 2023
1 parent f770954 commit 3d1f0c4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/netns_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3d1f0c4

Please sign in to comment.