examples: fix double free in simple_filter#1
Merged
qmonnet merged 1 commit intoNetronome:masterfrom Aug 23, 2019
Merged
Conversation
qmonnet
suggested changes
Aug 23, 2019
Contributor
qmonnet
left a comment
There was a problem hiding this comment.
Nice catch, thanks!
We probably want to keep a free(rule) before jumping to destroy_filter if kefir_filter_add_rule() fails though, because in that case the rule may not have been attached and won't be destroyed along the filter. Would you mind adding that to your PR?
kefir_filter_destory iterates through the list of rules and calls destroy_rule on them, which does the free. The only case we need to manually free is when the rule fails to attach to the filter.
Contributor
Author
|
No problem! And yes, you are definitely correct for that case, good call. I amended the commit so it handles that properly. Let me know if you see anything else! |
Contributor
|
Looks all good now, thanks a lot! :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
kefir_filter_destory iterates through the list of rules and calls
destroy_rule on them, which does the free. As a result we do not
need to free the rule manually in simple_filter before we tear
the filter down.