]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: add null check before connecting recursive depend
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 21 Jan 2020 20:03:52 +0000 (15:03 -0500)
committerStephen Worley <sworley@cumulusnetworks.com>
Thu, 30 Jan 2020 22:15:06 +0000 (17:15 -0500)
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 <sworley@cumulusnetworks.com>
zebra/zebra_nhg.c

index 0925705a25679a21328c7b580a814f27d9fd8693..a3b414975ec52bdff738831d13dbb1f5d6e541f3 100644 (file)
@@ -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,