Skip to content

examples: fix double free in simple_filter#1

Merged
qmonnet merged 1 commit intoNetronome:masterfrom
freshdresch:master
Aug 23, 2019
Merged

examples: fix double free in simple_filter#1
qmonnet merged 1 commit intoNetronome:masterfrom
freshdresch:master

Conversation

@freshdresch
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@freshdresch
Copy link
Copy Markdown
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!

@qmonnet
Copy link
Copy Markdown
Contributor

qmonnet commented Aug 23, 2019

Looks all good now, thanks a lot! :)

@qmonnet qmonnet merged commit efb559e into Netronome:master Aug 23, 2019
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.

2 participants