From 41c718edcaf7a3f7efc9705c76b986f475153632 Mon Sep 17 00:00:00 2001 From: zhailiangliang Date: Tue, 11 Oct 2022 10:07:32 +0800 Subject: [PATCH] Fix memory leak in PSP_CreateTexture --- src/render/psp/SDL_render_psp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 6cfb43a99..3e176463d 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -525,6 +525,7 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) break; default: + SDL_free(psp_texture); return -1; } @@ -532,6 +533,7 @@ PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) psp_texture->size = psp_texture->textureHeight*psp_texture->pitch; if(texture->access & SDL_TEXTUREACCESS_TARGET) { if(TextureSpillTargetsForSpace(renderer->driverdata, psp_texture->size) < 0){ + SDL_free(psp_texture); return -1; } psp_texture->data = valloc(psp_texture->size); @@ -1372,10 +1374,7 @@ PSP_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->driverdata = data; renderer->window = window; - if (data->initialized != SDL_FALSE) - return 0; data->initialized = SDL_TRUE; - data->most_recent_target = NULL; data->least_recent_target = NULL;