bgpd: improve cleanup in bgp_delete()

Signed-off-by: Lou Berger <lberger@labn.net>
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index fa2f488..d1c5c86 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -591,6 +591,14 @@
                                   bgp_address_hash_cmp);
 }
 
+void
+bgp_address_destroy (void)
+{
+  hash_clean(bgp_address_hash, NULL);
+  hash_free(bgp_address_hash);
+  bgp_address_hash = NULL;
+}
+
 static void
 bgp_address_add (struct prefix *p)
 {
@@ -1467,3 +1475,16 @@
   bgp_connected_table[AFI_IP6] = NULL;
 #endif /* HAVE_IPV6 */
 }
+
+void
+bgp_scan_destroy (void)
+{
+  if (zlookup == NULL)
+    return;
+  THREAD_OFF(bgp_import_thread);
+  THREAD_OFF(bgp_scan_thread);
+  THREAD_OFF(zlookup->t_connect);
+  bgp_scan_finish();
+  zclient_free (zlookup);
+  zlookup = NULL;
+}