bgpd: Add a null check in bgp_address_del() function when connected addresses are removed.
When you flap an interface repeatedly, you can get into situations where
the code has not quite finished cleaning up before the next event happens.
Gracefully prevent a NULL dereference.
Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index badada7..b69ed6f 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -582,6 +582,9 @@
tmp.addr = p->u.prefix4;
addr = hash_get (bgp_address_hash, &tmp, bgp_address_hash_alloc);
+ if (!addr)
+ return;
+
addr->refcnt++;
}