Browse Source

bgpd: tests - add null pointer protection to fix bgp test failures

Signed-off-by: Lou Berger <lberger@labn.net>
Lou Berger 5 years ago
parent
commit
d5d5e3e04f
2 changed files with 5 additions and 1 deletions
  1. 3 0
      bgpd/bgp_nexthop.c
  2. 2 1
      tests/bgp_mpath_test.c

+ 3 - 0
bgpd/bgp_nexthop.c

@@ -594,6 +594,9 @@ bgp_address_init (void)
 void
 bgp_address_destroy (void)
 {
+  if (bgp_address_hash == NULL)
+    return;
+
   hash_clean(bgp_address_hash, NULL);
   hash_free(bgp_address_hash);
   bgp_address_hash = NULL;

+ 2 - 1
tests/bgp_mpath_test.c

@@ -395,7 +395,8 @@ global_test_init (void)
 static int
 global_test_cleanup (void)
 {
-  zclient_free (zclient);
+  if (zclient != NULL)
+    zclient_free (zclient);
   thread_master_free (master);
   return 0;
 }