From a7e1b02d4a6794a5caa475ab6e4bfc30fdc6b31b Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Tue, 21 Jan 2020 15:03:52 -0500 Subject: [PATCH] zebra: add null check before connecting recursive depend Add a null check in `handle_recursive_depend()` so it doesn't try to add a NULL pointer to the RB tree. This was found with clang SA. Signed-off-by: Stephen Worley --- zebra/zebra_nhg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 0925705a25..a3b414975e 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -510,7 +510,9 @@ static void handle_recursive_depend(struct nhg_connected_tree_head *nhg_depends, resolved_ng.nexthop = nh; depend = zebra_nhg_rib_find(0, &resolved_ng, afi); - depends_add(nhg_depends, depend); + + if (depend) + depends_add(nhg_depends, depend); } static bool zebra_nhg_find(struct nhg_hash_entry **nhe, uint32_t id, -- 2.39.5