]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Add NULL check before nhg_connected insert
authorStephen Worley <sworley@cumulusnetworks.com>
Tue, 14 May 2019 21:36:48 +0000 (14:36 -0700)
committerStephen Worley <sworley@cumulusnetworks.com>
Fri, 25 Oct 2019 15:13:39 +0000 (11:13 -0400)
Add a check to make sure we allocated the nhg_connected
before inserting into the RB tree.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
zebra/zebra_nhg.c

index ebddeb3f9514dbb028c9ae04d581658a5579e7cf..a23af36b3444024edc83f88183ad51c52f158d7b 100644 (file)
@@ -122,7 +122,8 @@ void nhg_connected_head_add(struct nhg_connected_head *head,
 
        new = nhg_connected_new(depend);
 
-       RB_INSERT(nhg_connected_head, head, new);
+       if (new)
+               RB_INSERT(nhg_connected_head, head, new);
 }
 
 unsigned int zebra_nhg_depends_count(const struct nhg_hash_entry *nhe)