-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Equeue unchain bugs #8567
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
We have run into some issues when we need to unchain and chain a queue multiple times. After a certain amount of those sequences we encountered a hardfault.
We are running mbed os 5.10.0 at the moment but there haven't been any changes to this since.
There are 2 separate issues which caused the hardfault.
The first is the actual memory leak which seems to happen in this example:
What actually happens is that on the first chain, there is memory allocated from the slab of q1 to place the chained q2 event. This seems to be the wanted behaviour. Unchaining removes the event from the q1 queue but places the chunk that was allocated from the q1 slab in the chunk list of q2. The chuck can never be used by q1 again which means it is sort of a memory leak looking from the q1 perspective.
To me it looks like line 604 in equeue.c calls dealloc on the wrong object. This line should be:
equeue_dealloc(c->q, c);
instead ofequeue_dealloc(c->target, c);
The second issue is the fact that the chain function does not check if equeue_alloc returns a valid pointer or a null. This resulted in the hardfault further on because of using null where that was not possible. This could be easily fixed by checking the pointer and returning an error code.
Issue request type
[ ] Question
[ ] Enhancement
[x] Bug
The text was updated successfully, but these errors were encountered: