From 005b6bc0ab626fa000d14e91d5177ef264372774 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Tue, 12 Jan 2016 13:41:58 -0500 Subject: [PATCH] bgpd: tests - add null pointer protection to fix bgp test failures Signed-off-by: Lou Berger (cherry picked from commit d5d5e3e04fc41b9a89b7ce9049fd322bdbde2e4d) Conflicts: bgpd/bgp_nexthop.c --- bgpd/bgp_nexthop.c | 2 ++ tests/bgp_mpath_test.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index d81c6a8052..80495065b0 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -148,6 +148,8 @@ bgp_address_init (struct bgp *bgp) void bgp_address_destroy (struct bgp *bgp) { + 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 af62308b88..bafbef75fb 100644 --- a/tests/bgp_mpath_test.c +++ b/tests/bgp_mpath_test.c @@ -387,7 +387,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; } -- 2.39.5