Skip to content

Commit

Permalink
Memory allocated from parent queue was freed/added to chained queue.
Browse files Browse the repository at this point in the history
Issue was seen with below example
EventQueue q1;
EventQueue q2;

void main() {
while( true ) {
q1.chain( &q2 ); // Chain q2 to q1
q1.chain( NULL ); // Remove chain from q1
//This second step should free the memory from the chained q2 event.
}
}

Memory allocated from q1 slab was freed for q2, which will result in
memory leak.
  • Loading branch information
deepikabhavnani authored and geky committed Aug 4, 2019
1 parent 4019f30 commit dc80add
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion equeue.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ static void equeue_chain_update(void *p, int ms) {
if (ms >= 0) {
c->id = equeue_call_in(c->target, ms, equeue_chain_dispatch, c->q);
} else {
equeue_dealloc(c->target, c);
equeue_dealloc(c->q, c);
}
}

Expand Down

0 comments on commit dc80add

Please sign in to comment.