diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index df0fd05f8..85319eaf0 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1438,6 +1438,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, } if (!convert_format(data, temp_format, &internalFormat, &format, &type)) { + SDL_free(temp_pixels); return SDL_SetError("Texture format %s not supported by OpenGL", SDL_GetPixelFormatName(temp_format)); }