-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix memory leaks when tokens are missing #463
Conversation
And what about leak when you allocate |
Good catch! I did not go deep into the Lines 351 to 353 in e064032
|
It is a corner case not worth optimizing for IMHO. |
In case we have slots advertized but the driver fails to return information or the token is not present we were leaking memory as the slot is not added to the array and the number of slots is not incremented. Ensure the slot struct is freed in this case. And ensure the slot is assigned and count incremented at the same time to avoid leaks from other error conditions. Signed-off-by: Simo Sorce <[email protected]>
I misread the comment, sorry, pushed another change that drops the early return in the freeing function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
ty! |
Description
In case we have slots advertized but the driver fails to return information or the token is not present we were leaking memory as the slot is not added to the array and the number of slots is not incremented.
Ensure the slot struct is freed in this case.
Fixes #462
Checklist
Test suite updated with functionality testsTest suite updated with negative testsDocumentation updatedReviewer's checklist: