Commit fe46569cce4b9b14ab6d415a152ccd5b4c6abc0e

Mathieu Eyraud 2022-05-21T10:44:50

Fix potential memory leak in SDL_AddHintCallback

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/SDL_hints.c b/src/SDL_hints.c
index d3fc8ab..0005f49 100644
--- a/src/SDL_hints.c
+++ b/src/SDL_hints.c
@@ -179,6 +179,7 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
         }
         hint->name = SDL_strdup(name);
         if (!hint->name) {
+            SDL_free(entry);
             SDL_free(hint);
             SDL_OutOfMemory();
             return;