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

[bug report] function packet_handle_std_validate memory leak #285

Open
davidmpc opened this issue Sep 25, 2018 · 0 comments
Open

[bug report] function packet_handle_std_validate memory leak #285

davidmpc opened this issue Sep 25, 2018 · 0 comments

Comments

@davidmpc
Copy link

davidmpc commented Sep 25, 2018

The function packet_handle_std_validate has a memory leak issue. When I set handle->valid= false after push experimenter match fields, this function will be called for the second time and memory leak happens.
It's because that the function doesn't free hash map so that it can't be called twice. The modified code looks like this:

/* Free fields allocated previously */
HMAP_FOR_EACH_SAFE(iter, next, struct ofl_match_tlv, hmap_node, &m->match_fields) {
free(iter->value);
free(iter);
}
/* Resets all protocol fields to NULL */
protocols_reset(proto);

//hmap isn't freed,memory leak occurs when a packet has been validated twice
hmap_destroy(&m->match_fields);

ofl_structs_match_init(m);
handle->valid = true;

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

No branches or pull requests

1 participant