[bgp] Fix crash on SIGHUP, deref of freed workqueues
* lib/workqueue.c: free-ing workqueues had never been tested obviously,
queue's thread was not being stopped
* bgpd/bgpd.c: null out freed workqueues, to prevent acting on freed
workqueues
diff --git a/lib/workqueue.c b/lib/workqueue.c
index 1d32d24..7c811ed 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -91,6 +91,9 @@
void
work_queue_free (struct work_queue *wq)
{
+ if (wq->thread != NULL)
+ thread_cancel(wq->thread);
+
/* list_delete frees items via callback */
list_delete (wq->items);
listnode_delete (&work_queues, wq);