SDL: testcustomcursor: plug memory leak

From e79cfbe520716d59acdca9d225db8efcf298bac1 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 22 Dec 2025 22:12:44 +0100
Subject: [PATCH] testcustomcursor: plug memory leak

---
 test/testcustomcursor.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/testcustomcursor.c b/test/testcustomcursor.c
index 911f259ee222a..c0a6a1b38fd29 100644
--- a/test/testcustomcursor.c
+++ b/test/testcustomcursor.c
@@ -304,7 +304,12 @@ static SDL_Cursor *init_animated_cursor(const char *image[], bool oneshot)
         frame_count = 6;
     }
 
-    return SDL_CreateAnimatedCursor(frames, frame_count, hot_x, hot_y);
+    SDL_Cursor *cursor = SDL_CreateAnimatedCursor(frames, frame_count, hot_x, hot_y);
+
+    SDL_DestroySurface(surface);
+    SDL_DestroySurface(invsurface);
+
+    return cursor;
 }
 
 static SDLTest_CommonState *state;