summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_spf.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-10-05 16:51:01 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-10-05 16:53:13 +0200
commitaffe9e99831408960b8b6f8477506ed2874a05dd (patch)
treea6f2f7a898fad5fcdc3f74b233095b6e8f6a2b46 /ospfd/ospf_spf.c
parentMerge pull request #1244 from donaldsharp/flush_routes (diff)
downloadfrr-affe9e99831408960b8b6f8477506ed2874a05dd.tar.xz
frr-affe9e99831408960b8b6f8477506ed2874a05dd.zip
*: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use struct list **. This is to allow the list pointer to be nulled. I keep running into uses of this list_delete function where we forget to set the returned pointer to NULL and attempt to use it and then experience a crash, usually after the developer has long since left the building. Let's make the api explicit in it setting the list pointer to null. Cynical Prediction: This code will expose a attempt to use the NULL'ed list pointer in some obscure bit of code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ospfd/ospf_spf.c')
-rw-r--r--ospfd/ospf_spf.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c
index 5e5742608..65437dba9 100644
--- a/ospfd/ospf_spf.c
+++ b/ospfd/ospf_spf.c
@@ -210,12 +210,10 @@ static void ospf_vertex_free(void *data)
// assert (listcount (v->parents) == 0);
if (v->children)
- list_delete(v->children);
- v->children = NULL;
+ list_delete_and_null(&v->children);
if (v->parents)
- list_delete(v->parents);
- v->parents = NULL;
+ list_delete_and_null(&v->parents);
v->lsa = NULL;
@@ -1089,7 +1087,7 @@ void ospf_rtrs_free(struct route_table *rtrs)
for (ALL_LIST_ELEMENTS(or_list, node, nnode, or))
ospf_route_free(or);
- list_delete(or_list);
+ list_delete_and_null(&or_list);
/* Unlock the node. */
rn->info = NULL;