Skip to content

Commit b893d56

Browse files
author
deepikabhavnani
committed
Old pointers of sibling were not cleared
When adding sibling at the head of linked list, the head if pointing to something in linked list was not updated, hence a loop was formed in linked list Element0 - First addition to linked list Element1 - Has higher delay hence added to back 0 ->(next) 1 Element2 - Delay is same as Element0, hence should be sibling of 0 Shall be added at head Expected: 2 ------------->(next) 1 |(sibling) 0 Bug: (Resolved with this) 2 ------------->(next) 1 |(sibling) 0 ------------->(next) 1 If we add more elements and next pointer of sibling is updated, old references will cause issues Element3 added Expected: 2 ------------->(next) 3 ------------->(next) 1 |(sibling) 0 Bug: (Resolved with this) 2 ------------->(next) 3 ------------->(next) 1 |(sibling) 0 ------------->(next) 1 ***Both siblings here point to different next***
1 parent 0a832dd commit b893d56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

events/equeue/equeue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ static int equeue_enqueue(equeue_t *q, struct equeue_event *e, unsigned tick)
239239
if (e->next) {
240240
e->next->ref = &e->next;
241241
}
242-
243242
e->sibling = *p;
243+
e->sibling->next = 0;
244244
e->sibling->ref = &e->sibling;
245245
} else {
246246
e->next = *p;

0 commit comments

Comments
 (0)