]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Add nullcheck before graph node deletion
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 9 Sep 2016 19:45:43 +0000 (19:45 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 9 Sep 2016 19:45:43 +0000 (19:45 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/graph.c

index 314cf868509c6cf9829bb808aa8837b15127c2b0..18f32b8ca2a051973953aa50a53990c0f4339c09 100644 (file)
@@ -62,6 +62,7 @@ graph_delete_node (struct graph *graph, struct graph_node *node)
   for (unsigned int i = 0; i < vector_active (node->from); i++)
     {
       adj = vector_slot (node->from, i);
+      if (!adj) continue;
       for (unsigned int j = 0; j < vector_active (adj->to); j++)
         if (vector_slot (adj->to, j) == node)
           vector_unset (adj->to, j);
@@ -71,6 +72,7 @@ graph_delete_node (struct graph *graph, struct graph_node *node)
   for (unsigned int i = 0; i < vector_active (node->to); i++)
     {
       adj = vector_slot (node->to, i);
+      if (!adj) continue;
       for (unsigned int j = 0; j < vector_active (adj->from); j++)
         if (vector_slot (adj->from, j) == node)
           vector_unset (adj->from, j);