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

Init pkg->tags to NULL in pkg_init #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Init pkg->tags to NULL in pkg_init #2

wants to merge 1 commit into from

Conversation

lnksz
Copy link

@lnksz lnksz commented Jun 7, 2019

Bug

pkg_t pkg;
pkg_init_from_file(&next, "/tmp/some.ipk"); // This calls pkg_init() under the hood
// Use pkg here
pkg_deinit(&pkg); // ==> free(pkg->tags) freeing an uninitialized pointer

This is not surfacing if one uses the pkg_new() call, as the underlaying calloc() sets this to 0, which could be NULL, so the free is ok. But as the described method is also legit by the API and spares a possible memory leak, the init should be added.

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