diff --git a/include/proto/applet.h b/include/proto/applet.h index efcc52544..606f4b1bf 100644 --- a/include/proto/applet.h +++ b/include/proto/applet.h @@ -103,7 +103,7 @@ static inline void appctx_free(struct appctx *appctx) /* The task is supposed to be run on this thread, so we can just * check if it's running already (or about to run) or not */ - if (!(appctx->t->state & TASK_RUNNING)) + if (!(appctx->t->state & (TASK_QUEUED | TASK_RUNNING))) __appctx_free(appctx); else { /* if it's running, or about to run, defer the freeing diff --git a/include/proto/task.h b/include/proto/task.h index 1a89f2038..361ea8538 100644 --- a/include/proto/task.h +++ b/include/proto/task.h @@ -355,7 +355,7 @@ static inline void task_free(struct task *t) /* There's no need to protect t->state with a lock, as the task * has to run on the current thread. */ - if (t == curr_task || !(t->state & TASK_RUNNING)) + if (t == curr_task || !(t->state & (TASK_QUEUED | TASK_RUNNING))) __task_free(t); else t->process = NULL;