Skip to content
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 leak in join handler #7

Merged
merged 2 commits into from
Nov 23, 2022

Conversation

jackuess
Copy link
Contributor

The timer for deleting a group entry has associated data allocated on the heap. This data must be freed not only when the timer times out, but also when receiving a new join for the same group in which case we replace the currently active timer.

This PR adds a few functions to the pev API. If this PR is accepted I'll try to upstream these to https://github.com/troglobit/pev/

The private callback data is only available is only exposed in the API
when a callback is called. In a scenario where the private data has been
dynamically allocated on the heap and the event is deleted outside of the
callback this is problematic since the user of the API has no way of
deallocating this data.

This patch adds a new optional callback that gets called during the
deletion of an event. It is then possible to do what ever clean up is
necessary in this callback.

Signed-off-by: Jacques de Laval <[email protected]>
The timer for deleting a group entry has associated data allocated on the
heap. This data must be freed not only when the timer times out, but also
when receiving a new join for the same group in which case we replace the
currently active timer.

Signed-off-by: Jacques de Laval <[email protected]>
@jackuess jackuess merged commit d60c089 into main Nov 23, 2022
@jackuess jackuess deleted the usr/jacques/callback-data-memory-leak branch November 23, 2022 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant