diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-09-09 19:45:43 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-09-09 19:45:43 +0000 |
| commit | df0620e4a09f65c77e98d90309f6860dbcc399a8 (patch) | |
| tree | 06e699cc01882ee45bb7493876f84dadab8bee18 /lib/graph.c | |
| parent | 8d8cf5e3220bad44641d27b9eafbe7c5c4b2c41a (diff) | |
lib: Add nullcheck before graph node deletion
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/graph.c')
| -rw-r--r-- | lib/graph.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/graph.c b/lib/graph.c index 314cf86850..18f32b8ca2 100644 --- a/lib/graph.c +++ b/lib/graph.c @@ -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); |
