freebsd_network: Unlock the taskqueue before waiting for threads.
Also set tq_threads to NULL to prevent double-frees.
This commit is contained in:
@@ -111,7 +111,10 @@ taskqueue_terminate(struct thread **pp, struct taskqueue *tq)
|
||||
if (tq->tq_sem == -1)
|
||||
return;
|
||||
|
||||
TQ_UNLOCK(tq);
|
||||
|
||||
delete_sem(tq->tq_sem);
|
||||
tq->tq_sem = -1;
|
||||
|
||||
for (int i = 0; i < tq->tq_threadcount; i++) {
|
||||
status_t status;
|
||||
@@ -120,6 +123,9 @@ taskqueue_terminate(struct thread **pp, struct taskqueue *tq)
|
||||
|
||||
if (tq->tq_threadcount > 1)
|
||||
free(tq->tq_threads);
|
||||
tq->tq_threads = NULL;
|
||||
|
||||
TQ_LOCK(tq);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user