From 959f4588a164f0a524c4a654b06fcade01f5e6d5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 15 May 2018 12:35:19 -0700 Subject: fixes #433 tasks can leak While here I also improved the taskq.h comments (and removed a stale prototype for nni_task_cancel), and addressed leaks in the reqstress and multistress test programs. --- src/core/taskq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/taskq.c') diff --git a/src/core/taskq.c b/src/core/taskq.c index a87e4729..d945e713 100644 --- a/src/core/taskq.c +++ b/src/core/taskq.c @@ -285,7 +285,7 @@ nni_task_fini(nni_task *task) { NNI_ASSERT(!nni_list_node_active(&task->task_node)); nni_mtx_lock(&task->task_mtx); - if (task->task_run || task->task_exec) { + if ((task->task_run || task->task_exec) && (!task->task_done)) { // destroy later. task->task_fini = true; nni_mtx_unlock(&task->task_mtx); -- cgit v1.2.3-70-g09d2