Skip to content

Commit 01b2530

Browse files
author
deepikabhavnani
committed
Corrected destructor loop to clear all pending events
In `equeue_destroy` the external loop was for main events linked list and internal loop for siblings. Siblings start was not initialized correctly for each main link
1 parent b893d56 commit 01b2530

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

events/equeue/equeue.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,15 @@ void equeue_destroy(equeue_t *q)
108108
{
109109
// call destructors on pending events
110110
for (struct equeue_event *es = q->queue; es; es = es->next) {
111-
for (struct equeue_event *e = q->queue; e; e = e->sibling) {
111+
for (struct equeue_event *e = es->sibling; e; e = e->sibling) {
112112
if (e->dtor) {
113113
e->dtor(e + 1);
114114
}
115115
}
116+
if (es->dtor) {
117+
es->dtor(es + 1);
118+
}
116119
}
117-
118120
// notify background timer
119121
if (q->background.update) {
120122
q->background.update(q->background.timer, -1);

0 commit comments

Comments
 (0)