Fixed memory leak in WIN_CreateBlankCursor()

This commit is contained in:
Sam Lantinga 2022-03-17 17:55:28 -07:00
parent 5ff42438e3
commit 0387bf821a
1 changed files with 4 additions and 2 deletions

View File

@ -175,11 +175,13 @@ WIN_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
static SDL_Cursor * static SDL_Cursor *
WIN_CreateBlankCursor() WIN_CreateBlankCursor()
{ {
SDL_Cursor *cursor = NULL;
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, 32, 32, 32, SDL_PIXELFORMAT_ARGB8888); SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, 32, 32, 32, SDL_PIXELFORMAT_ARGB8888);
if (surface) { if (surface) {
return WIN_CreateCursor(surface, 0, 0); cursor = WIN_CreateCursor(surface, 0, 0);
SDL_FreeSurface(surface);
} }
return NULL; return cursor;
} }
static SDL_Cursor * static SDL_Cursor *