We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2647 - Memory leak in SDL_AddHintCallback function - SDL_hints.c
Summary: Memory leak in SDL_AddHintCallback function - SDL_hints.c
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.3
Hardware: All All
: P2 critical
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-17 07:57 UTC by Nitz
Modified: 2014-10-29 19:54 UTC (History)
2 users (show)

See Also:


Attachments
Patch for memory leak in SDL_AddHintCallback function (457 bytes, text/plain)
2014-07-17 07:57 UTC, Nitz
Details
Patch to fix memory leak in entry pointer (488 bytes, patch)
2014-07-25 10:01 UTC, Nitz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nitz 2014-07-17 07:57:32 UTC
Created attachment 1766 [details]
Patch for memory leak in SDL_AddHintCallback function

Variable entry going out of scope leaks the storage it points to, at:

        /* Need to add a hint entry for this watcher */
        hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
        if (!hint) {
            return;
        }

Patch is attached.

Thanks...
Comment 1 Nitz 2014-07-25 10:01:11 UTC
Created attachment 1786 [details]
Patch to fix memory leak in entry pointer
Comment 2 Philipp Wiesemann 2014-10-29 19:54:00 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/21d9f9babb30