libubox: runqueue: fix use-after-free bug
[project/libubox.git] / runqueue.c
index a1d013361aabe4cfb1b067430ce592e396b94d54..d5719d1f7fdb756afdb5749cbf56d36e686e53c7 100644 (file)
@@ -196,11 +196,10 @@ void runqueue_task_kill(struct runqueue_task *t)
        if (!t->queued)
                return;
 
        if (!t->queued)
                return;
 
-       runqueue_task_complete(t);
        if (running && t->type->kill)
                t->type->kill(q, t);
 
        if (running && t->type->kill)
                t->type->kill(q, t);
 
-       runqueue_start_next(q);
+       runqueue_task_complete(t);
 }
 
 void runqueue_stop(struct runqueue *q)
 }
 
 void runqueue_stop(struct runqueue *q)