diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 9d7c38c871..e3650417fa 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3087,6 +3087,8 @@ int bgp_delete(struct bgp *bgp) * routes to be processed still referencing the struct bgp. */ listnode_delete(bm->bgp, bgp); + if (list_isempty(bm->bgp)) + bgp_close(); /* Deregister from Zebra, if needed */ if (IS_BGP_INST_KNOWN_TO_ZEBRA(bgp))