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 various potential memory misuses #160

Merged
merged 1 commit into from
Feb 3, 2021
Merged

Conversation

root-hardenedvault
Copy link
Contributor

  • g_free() of libglib is not interchangeable with free() of libc, if
    glib is built with ENABLE_MEM_PROFILE or ENABLE_MEM_CHECK defined,
    so memory allocated with g_malloc() family should be released with
    g_free() rather than free(), as
    https://mail.gnome.org/archives/gtk-list/2000-July/msg00002.html
    pointed out.

  • the return value of xmlnode_to_str() should be released with
    g_free(), otherwise it is leaked.

Signed-off-by: HardenedVault [email protected]

@root-hardenedvault root-hardenedvault changed the base branch from master to dev February 1, 2021 08:34
@gkdr
Copy link
Owner

gkdr commented Feb 2, 2021

hi @root-hardenedvault, thanks once again for your contribution 🙂

i still remember trying to find out whether free() and g_free() are interchangeable and concluded that they are, but now every search result points towards the opposite. weird, i wonder how i ended up at that conclusion 😬

good thing you caught both of these things. could you fix the missing semicolon at the end of line 502 (as the CI pointed out) so i can merge?

   * g_free() of libglib is not interchangeable with free() of libc, if
glib is built with ENABLE_MEM_PROFILE or ENABLE_MEM_CHECK defined,
so memory allocated with g_malloc() family should be released with
g_free() rather than free(), as
https://mail.gnome.org/archives/gtk-list/2000-July/msg00002.html
pointed out.

   * the return value of xmlnode_to_str() should be released with
g_free(), otherwise it is leaked.

Signed-off-by: HardenedVault <[email protected]>
@root-hardenedvault
Copy link
Contributor Author

Fixed. The codecov report shouldn't bothers?

@gkdr
Copy link
Owner

gkdr commented Feb 3, 2021

thanks! yeah, just ignore the codecov stuff. i need to configure it better.

@gkdr gkdr merged commit e8238cf into gkdr:dev Feb 3, 2021
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