summaryrefslogtreecommitdiffstats
path: root/bgpd/rfapi/rfapi_rib.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 /bgpd/rfapi/rfapi_rib.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 'bgpd/rfapi/rfapi_rib.c')
-rw-r--r--bgpd/rfapi/rfapi_rib.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 748c0c476..92cd1888e 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -510,13 +510,12 @@ void rfapiRibClear(struct rfapi_descriptor *rfd)
*/
if (pn->info) {
if (pn->info != (void *)1) {
- list_delete(
- (struct list
- *)(pn->info));
+ list_delete_and_null(
+ (struct list **)(&pn->info));
}
pn->info = NULL;
- route_unlock_node(
- pn); /* linklist or 1 deleted */
+ /* linklist or 1 deleted */
+ route_unlock_node(pn);
}
}
}
@@ -1435,7 +1434,7 @@ callback:
}
delete_list->del = (void (*)(void *))rfapi_info_free;
- list_delete(delete_list);
+ list_delete_and_null(&delete_list);
}
RFAPI_RIB_CHECK_COUNTS(0, 0);
@@ -1450,7 +1449,7 @@ callback:
route_unlock_node(pn);
}
if (lPendCost) {
- list_delete(lPendCost);
+ list_delete_and_null(&lPendCost);
pn->info = NULL;
route_unlock_node(pn);
}
@@ -1634,7 +1633,7 @@ void rfapiRibUpdatePendingNode(
*/
if (pn->info) {
if (pn->info != (void *)1) {
- list_delete((struct list *)(pn->info));
+ list_delete_and_null((struct list **)(&pn->info));
}
pn->info = NULL;
route_unlock_node(pn); /* linklist or 1 deleted */