From e58c2731fe83f539453a3dba5606e444020f42fe Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 16 Aug 2023 12:32:58 -0400 Subject: [PATCH] mouse: Free the default cursor when destroyed The default cursor was being leaked on destruction as it is not in the cursor list, and subsequently SDL_DestroyCursor() wouldn't call the free function for it. --- src/events/SDL_mouse.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index fd8b62cee5..79d0b6518a 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -239,7 +239,11 @@ void SDL_SetDefaultCursor(SDL_Cursor *cursor) } mouse->def_cursor = NULL; - SDL_DestroyCursor(default_cursor); + if (mouse->FreeCursor && default_cursor->driverdata) { + mouse->FreeCursor(default_cursor); + } else { + SDL_free(default_cursor); + } } mouse->def_cursor = cursor;