Skip to content

Commit

Permalink
[libhilti] Correct nullpointer hlt_timer_cancel
Browse files Browse the repository at this point in the history
On hlt_execution_context_delete, map dtor executes hlt_timer_cancel
that calls priority_queue_remove with *mgr->timers->d equals to 0, this
produces a segfault ( getpri(q->[posn] = 0x0) ).
Fix this bug by checking *mgr->timers->d value before the call
  • Loading branch information
FrozenCaribou committed Jun 24, 2016
1 parent a6f7434 commit f1ba048
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libhilti/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ void hlt_timer_cancel(hlt_timer* timer, hlt_exception** excpt, hlt_execution_con
return;
}

priority_queue_remove(timer->mgr->timers, timer);
if (*timer->mgr->timers->d != 0)
priority_queue_remove(timer->mgr->timers, timer);
GC_DTOR(timer, hlt_timer, ctx);

timer->mgr = 0;
Expand Down

0 comments on commit f1ba048

Please sign in to comment.