diff --git a/events/equeue/equeue.c b/events/equeue/equeue.c index 19c7ffee9e..d89d5c62f0 100644 --- a/events/equeue/equeue.c +++ b/events/equeue/equeue.c @@ -108,13 +108,15 @@ void equeue_destroy(equeue_t *q) { // call destructors on pending events for (struct equeue_event *es = q->queue; es; es = es->next) { - for (struct equeue_event *e = q->queue; e; e = e->sibling) { + for (struct equeue_event *e = es->sibling; e; e = e->sibling) { if (e->dtor) { e->dtor(e + 1); } } + if (es->dtor) { + es->dtor(es + 1); + } } - // notify background timer if (q->background.update) { q->background.update(q->background.timer, -1);