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

Summary: Memory leak in SDL_AddHintCallback function - SDL_hints.c
Product: SDL Reporter: Nitz <nitin.j4>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2 CC: philipp.wiesemann, sdlbug
Version: 2.0.3   
Hardware: All   
OS: All   
Attachments: Patch for memory leak in SDL_AddHintCallback function
Patch to fix memory leak in entry pointer

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