From: Willy Tarreau Date: Mon, 25 Mar 2019 17:10:53 +0000 (+0100) Subject: CLEANUP: task: only perform a LIST_DEL() when the list is not empty X-Git-Tag: v2.0-dev2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a33d39a1b15459ac34b4228b2510eba97a4f0c85;p=thirdparty%2Fhaproxy.git CLEANUP: task: only perform a LIST_DEL() when the list is not empty In tasklet_free() we unconditionally perform a LIST_DEL() even when the list is empty, let's move the LIST_DEL() inside the matching block. --- diff --git a/include/proto/task.h b/include/proto/task.h index c876e7320a..1f4b52e971 100644 --- a/include/proto/task.h +++ b/include/proto/task.h @@ -380,10 +380,10 @@ static inline void task_free(struct task *t) static inline void tasklet_free(struct tasklet *tl) { if (!LIST_ISEMPTY(&tl->list)) { + LIST_DEL(&tl->list); task_per_thread[tid].task_list_size--; _HA_ATOMIC_SUB(&tasks_run_queue, 1); } - LIST_DEL(&tl->list); pool_free(pool_head_tasklet, tl); if (unlikely(stopping))