summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLou Berger <lberger@labn.net>2016-01-12 13:41:58 -0500
committerPaul Jakma <paul.jakma@hpe.com>2016-02-26 14:11:43 +0000
commitd5d5e3e04fc41b9a89b7ce9049fd322bdbde2e4d (patch)
tree7199aaf51bd89a8532b46cff042316ed00a2d6ad
parent82dd707988b7481e203cab058c92f0b3041dd558 (diff)
downloadquagga-d5d5e3e04fc41b9a89b7ce9049fd322bdbde2e4d.tar.bz2
quagga-d5d5e3e04fc41b9a89b7ce9049fd322bdbde2e4d.tar.xz
bgpd: tests - add null pointer protection to fix bgp test failures
Signed-off-by: Lou Berger <lberger@labn.net>
-rw-r--r--bgpd/bgp_nexthop.c3
-rw-r--r--tests/bgp_mpath_test.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index d1c5c864..bb07eace 100644
--- a/bgpd/bgp_nexthop.c
+++ b/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;
diff --git a/tests/bgp_mpath_test.c b/tests/bgp_mpath_test.c
index a953ce9e..174d2998 100644
--- a/tests/bgp_mpath_test.c
+++ b/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;
}