diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 0d24c9c294..20fa138ce8 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -227,7 +227,6 @@ bgp_exit (int status) { struct bgp *bgp; struct listnode *node, *nnode; - extern struct zclient *zclient; /* it only makes sense for this to be called on a clean exit */ assert (status == 0); @@ -277,8 +276,8 @@ bgp_exit (int status) bgp_vrf_terminate (); cmd_terminate (); vty_terminate (); - if (zclient) - zclient_free (zclient); + + bgp_zebra_destroy(); if (bgp_nexthop_buf) stream_free (bgp_nexthop_buf); if (bgp_ifindices_buf) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index b18572c07a..f63f3f8f94 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3178,6 +3178,8 @@ bgp_delete (struct bgp *bgp) /* Free interfaces in this instance. */ bgp_if_finish (bgp); + bgp_address_destroy (bgp); + thread_master_free_unused(bm->master); bgp_unlock(bgp); /* initial reference */