mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
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.
This commit is contained in:
parent
8adffaa899
commit
3a8c63d48d
@ -621,6 +621,9 @@ static inline void task_destroy(struct task *t)
|
|||||||
/* Should only be called by the thread responsible for the tasklet */
|
/* Should only be called by the thread responsible for the tasklet */
|
||||||
static inline void tasklet_free(struct tasklet *tl)
|
static inline void tasklet_free(struct tasklet *tl)
|
||||||
{
|
{
|
||||||
|
if (!tl)
|
||||||
|
return;
|
||||||
|
|
||||||
if (MT_LIST_DELETE(list_to_mt_list(&tl->list)))
|
if (MT_LIST_DELETE(list_to_mt_list(&tl->list)))
|
||||||
_HA_ATOMIC_DEC(&ha_thread_ctx[tl->tid >= 0 ? tl->tid : tid].rq_total);
|
_HA_ATOMIC_DEC(&ha_thread_ctx[tl->tid >= 0 ? tl->tid : tid].rq_total);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user