]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: Make `tasklet_free()` safe to be called with `NULL`
authorTim Duesterhus <tim@bastelstu.be>
Sat, 22 Apr 2023 15:47:31 +0000 (17:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 22 Apr 2023 22:28:25 +0000 (00:28 +0200)
Make this freeing function safe, like other freeing functions are as discussed
in GitHub issue #2126.

include/haproxy/task.h

index e31e9dac4875300a070c1bcf2272afc2c66f561f..390db0f8c720a7984fcf5bf448fec6eae92408ea 100644 (file)
@@ -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);