From 10abe1a75bf3ce781aaddd0a03a94d73e5de69b9 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Tue, 6 Aug 2024 11:13:58 -0400 Subject: [PATCH] wayland: Free the scaled cursor surface if SHM allocation fails --- src/video/wayland/SDL_waylandmouse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 69af379e77..30570c67cc 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -466,8 +466,8 @@ static Wayland_CachedCustomCursor *Wayland_GetCachedCustomCursor(SDL_Cursor *cur /* Allocate shared memory buffer for this cursor */ if (Wayland_AllocSHMBuffer(surface->w, surface->h, &cache->shmBuffer) != 0) { - SDL_free(cursor->internal); - SDL_free(cursor); + SDL_free(cache); + SDL_DestroySurface(surface); return NULL; }