mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 06:40:59 +01:00
BUG/MEDIUM: tasks: fix possible segfault on task_destroy()
Commit 3f795f7 ("MEDIUM: tasks: Merge task_delete() and task_free() into
task_destroy().") replaced task_delete() and task_free() with a single
function named task_destroy().
This patch adds a check for struct task* argument in function
task_destroy() to prevent a possible segfault on NULL and also to make
the function safer for use in other cases.
This commit is contained in:
parent
7d61a33921
commit
75bc6d3e59
@ -331,6 +331,9 @@ static inline void __task_free(struct task *t)
|
|||||||
|
|
||||||
static inline void task_destroy(struct task *t)
|
static inline void task_destroy(struct task *t)
|
||||||
{
|
{
|
||||||
|
if (!t)
|
||||||
|
return;
|
||||||
|
|
||||||
task_unlink_wq(t);
|
task_unlink_wq(t);
|
||||||
/* We don't have to explicitely remove from the run queue.
|
/* We don't have to explicitely remove from the run queue.
|
||||||
* If we are in the runqueue, the test below will set t->process
|
* If we are in the runqueue, the test below will set t->process
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user