From 5de3d1e9cc2b0099c6e504e205ea532a036ce810 Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Sun, 11 Aug 2024 12:31:48 +0200
Subject: [PATCH] Fix error handling of SDL_AddHintCallback
---
src/SDL_hints.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/SDL_hints.c b/src/SDL_hints.c
index 8a79ee16b70d0..0b84d68de9e20 100644
--- a/src/SDL_hints.c
+++ b/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;