Use after fix due to task free on non positive counting (#12138)

This commit is contained in:
David CARLIER 2018-11-13 10:56:57 +00:00 committed by radare
parent 8bc369ef3f
commit 5783cf42c4

View File

@ -242,12 +242,13 @@ R_API void r_core_task_decref (RCoreTask *task) {
return;
}
TASK_SIGSET_T old_sigset;
tasks_lock_enter (task->core, &old_sigset);
RCore *core = task->core;
tasks_lock_enter (core, &old_sigset);
task->refcount--;
if (task->refcount <= 0) {
task_free (task);
}
tasks_lock_leave (task->core, &old_sigset);
tasks_lock_leave (core, &old_sigset);
}
R_API void r_core_task_schedule(RCoreTask *current, RTaskState next_state) {