diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2016-10-31 18:15:16 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2016-11-28 19:18:35 +0100 |
commit | 5a8dfcd891fd12bb9db8f504bf3a083cea4f3cbd (patch) | |
tree | fcda5d991e405c4848158fc51af7a4e43ce4aee2 /zebra/main.c | |
parent | zebra: loop through all static routes on vrf enable/disable (diff) | |
download | frr-5a8dfcd891fd12bb9db8f504bf3a083cea4f3cbd.tar.xz frr-5a8dfcd891fd12bb9db8f504bf3a083cea4f3cbd.zip |
zebra: plug more memory leaks
Try to free all memory explicitly on exit. This should help to detect
new memory leaks in the future with tools like valgrind.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'zebra/main.c')
-rw-r--r-- | zebra/main.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/zebra/main.c b/zebra/main.c index 1b41f8def..4fea0104f 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -182,17 +182,27 @@ sighup (void) static void sigint (void) { + struct vrf *vrf; + struct zebra_vrf *zvrf; struct zebra_ns *zns; zlog_notice ("Terminating on signal"); - if (!retain_mode) - rib_close (); #ifdef HAVE_IRDP irdp_finish(); #endif zebra_ptm_finish(); + list_delete_all_node (zebrad.client_list); + + if (retain_mode) + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) + { + zvrf = vrf->info; + if (zvrf) + SET_FLAG (zvrf->flags, ZEBRA_VRF_RETAIN); + } + vrf_terminate (); zns = zebra_ns_lookup (NS_DEFAULT); zebra_ns_disable (0, (void **)&zns); @@ -204,6 +214,10 @@ sigint (void) vty_terminate (); zprivs_terminate (&zserv_privs); list_delete (zebrad.client_list); + work_queue_free (zebrad.ribq); + if (zebrad.lsp_process_q) + work_queue_free (zebrad.lsp_process_q); + meta_queue_free (zebrad.mq); thread_master_free (zebrad.master); if (zlog_default) closezlog (zlog_default); |