From: Tim Duesterhus Date: Sat, 22 Apr 2023 15:47:31 +0000 (+0200) Subject: MINOR: Make `tasklet_free()` safe to be called with `NULL` X-Git-Tag: v2.8-dev8~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a8c63d48d45cc18b68ab85f1237632e6f4c4f46;p=thirdparty%2Fhaproxy.git MINOR: Make `tasklet_free()` safe to be called with `NULL` Make this freeing function safe, like other freeing functions are as discussed in GitHub issue #2126. --- diff --git a/include/haproxy/task.h b/include/haproxy/task.h index e31e9dac48..390db0f8c7 100644 --- a/include/haproxy/task.h +++ b/include/haproxy/task.h @@ -621,6 +621,9 @@ static inline void task_destroy(struct task *t) /* Should only be called by the thread responsible for the tasklet */ static inline void tasklet_free(struct tasklet *tl) { + if (!tl) + return; + if (MT_LIST_DELETE(list_to_mt_list(&tl->list))) _HA_ATOMIC_DEC(&ha_thread_ctx[tl->tid >= 0 ? tl->tid : tid].rq_total);