ソースを参照

Fix error handling of SDL_AddHintCallback

Mathieu Eyraud 1 年間 前
コミット
5de3d1e9cc
1 ファイル変更2 行追加0 行削除
  1. 2 0
      src/SDL_hints.c

+ 2 - 0
src/SDL_hints.c

@@ -282,6 +282,8 @@ int SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userd
         hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
         if (!hint) {
             SDL_free(entry);
+            SDL_UnlockProperties(hints);
+            return -1;
         } else {
             hint->value = NULL;
             hint->priority = SDL_HINT_DEFAULT;