summaryrefslogtreecommitdiffstats
path: root/ospf6d
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 /ospf6d
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 'ospf6d')
-rw-r--r--ospf6d/ospf6_area.c2
-rw-r--r--ospf6d/ospf6_interface.c2
-rw-r--r--ospf6d/ospf6_route.c2
-rw-r--r--ospf6d/ospf6_spf.c4
-rw-r--r--ospf6d/ospf6_top.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index b5584dc86..b12678624 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -272,7 +272,7 @@ void ospf6_area_delete(struct ospf6_area *oa)
for (ALL_LIST_ELEMENTS_RO(oa->if_list, n, oi))
oi->area = NULL;
- list_delete(oa->if_list);
+ list_delete_and_null(&oa->if_list);
ospf6_lsdb_delete(oa->lsdb);
ospf6_lsdb_delete(oa->lsdb_self);
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 8e01cb437..7286b3242 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -242,7 +242,7 @@ void ospf6_interface_delete(struct ospf6_interface *oi)
for (ALL_LIST_ELEMENTS(oi->neighbor_list, node, nnode, on))
ospf6_neighbor_delete(on);
- list_delete(oi->neighbor_list);
+ list_delete_and_null(&oi->neighbor_list);
THREAD_OFF(oi->thread_send_hello);
THREAD_OFF(oi->thread_send_lsupdate);
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 117d2eef8..724258d2f 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -353,7 +353,7 @@ void ospf6_route_delete(struct ospf6_route *route)
{
if (route) {
if (route->nh_list)
- list_delete(route->nh_list);
+ list_delete_and_null(&route->nh_list);
XFREE(MTYPE_OSPF6_ROUTE, route);
}
}
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index ccfa25aaa..2381318b2 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -152,8 +152,8 @@ static struct ospf6_vertex *ospf6_vertex_create(struct ospf6_lsa *lsa)
static void ospf6_vertex_delete(struct ospf6_vertex *v)
{
- list_delete(v->nh_list);
- list_delete(v->child_list);
+ list_delete_and_null(&v->nh_list);
+ list_delete_and_null(&v->child_list);
XFREE(MTYPE_OSPF6_VERTEX, v);
}
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 9794e92b0..b0281b9e0 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -172,7 +172,7 @@ void ospf6_delete(struct ospf6 *o)
ospf6_area_delete(oa);
- list_delete(o->area_list);
+ list_delete_and_null(&o->area_list);
ospf6_lsdb_delete(o->lsdb);
ospf6_lsdb_delete(o->lsdb_self);