summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2019-05-14 14:36:48 -0700
committerStephen Worley <sworley@cumulusnetworks.com>2019-10-25 11:13:39 -0400
commit18cf7f15d635ba9738e98b7eeb5ff50cfacbec0e (patch)
treef1b9e1c718bf4cab61e62d34ea469ad24e92881e
parent085304dc09bad042df987d9fb62272afd993f7fe (diff)
zebra: Add NULL check before nhg_connected insert
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>
-rw-r--r--zebra/zebra_nhg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index ebddeb3f95..a23af36b34 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -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)