summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-02-05 16:40:09 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-03-09 17:07:41 +0100
commite208c8f94392286aaf77c6d8f2a8b4d22fa3f1d7 (patch)
tree1b21d5dfb0acb565aba34b27849fe5bc8c1e28c5 /bgpd
parentMerge pull request #1808 from qlyoung/debug-mt-safe (diff)
downloadfrr-e208c8f94392286aaf77c6d8f2a8b4d22fa3f1d7.tar.xz
frr-e208c8f94392286aaf77c6d8f2a8b4d22fa3f1d7.zip
bgpd, lib, zebra: Switch to work_queue_free_and_null
The work_queue_free function free'd up the wq pointer but did not set it too NULL. This of course causes situations where we may use the work_queue after it is freed. Let's modify the work_queue to set the pointer for you. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgpd.c12
-rw-r--r--bgpd/rfapi/rfapi_import.c2
-rw-r--r--bgpd/rfapi/rfapi_rib.c6
3 files changed, 7 insertions, 13 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 603457693..fde72da4c 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1079,10 +1079,8 @@ static void peer_free(struct peer *peer)
XFREE(MTYPE_TMP, peer->notify.data);
memset(&peer->notify, 0, sizeof(struct bgp_notify));
- if (peer->clear_node_queue) {
- work_queue_free(peer->clear_node_queue);
- peer->clear_node_queue = NULL;
- }
+ if (peer->clear_node_queue)
+ work_queue_free_and_null(&peer->clear_node_queue);
bgp_sync_delete(peer);
@@ -7639,10 +7637,8 @@ void bgp_terminate(void)
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_PEER_UNCONFIG);
- if (bm->process_main_queue) {
- work_queue_free(bm->process_main_queue);
- bm->process_main_queue = NULL;
- }
+ if (bm->process_main_queue)
+ work_queue_free_and_null(&bm->process_main_queue);
if (bm->t_rmap_update)
BGP_TIMER_OFF(bm->t_rmap_update);
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index c7d64bf1e..348f1557e 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -4336,7 +4336,7 @@ void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h)
h->import_mac = NULL;
}
- work_queue_free(h->deferred_close_q);
+ work_queue_free_and_null(&h->deferred_close_q);
if (h->rfp != NULL)
rfp_stop(h->rfp);
diff --git a/bgpd/rfapi/rfapi_rib.c b/bgpd/rfapi/rfapi_rib.c
index 2a8a465b7..c71f59563 100644
--- a/bgpd/rfapi/rfapi_rib.c
+++ b/bgpd/rfapi/rfapi_rib.c
@@ -571,10 +571,8 @@ void rfapiRibClear(struct rfapi_descriptor *rfd)
}
}
}
- if (rfd->updated_responses_queue) {
- work_queue_free(rfd->updated_responses_queue);
- rfd->updated_responses_queue = NULL;
- }
+ if (rfd->updated_responses_queue)
+ work_queue_free_and_null(&rfd->updated_responses_queue);
}
/*