]> git.puffer.fish Git - matthieu/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>
Fri, 3 Apr 2020 19:24:52 +0000 (15:24 -0400)
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>
(cherry picked from commit a7e1b02d4a6794a5caa475ab6e4bfc30fdc6b31b)

zebra/zebra_nhg.c

index 7a5b639206bb171ca21e8918306e44479c73cdab..fe44166fbcd225494d4f6bfaa00c23d9847d555b 100644 (file)
@@ -513,7 +513,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,