mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fixed bug 2647 - Memory leak in SDL_AddHintCallback function - SDL_hints.c
Nitz 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.
This commit is contained in:
parent
f2bd99da68
commit
2a46a9df21
@ -149,6 +149,11 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
|
|||||||
/* Need to add a hint entry for this watcher */
|
/* Need to add a hint entry for this watcher */
|
||||||
hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
|
hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
|
||||||
if (!hint) {
|
if (!hint) {
|
||||||
|
if(entry)
|
||||||
|
{
|
||||||
|
SDL_free(entry);
|
||||||
|
entry = NULL;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hint->name = SDL_strdup(name);
|
hint->name = SDL_strdup(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user