Fixed bug 2699 - possible memory leak in GL_RenderReadPixels Benoit Pierre If glReadPixels returns an error, than the temporary buffer is not deallocated
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index c43739e..ecd0d53 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -1429,6 +1429,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
format, type, temp_pixels);
if (GL_CheckError("glReadPixels()", renderer) < 0) {
+ SDL_free(temp_pixels);
return -1;
}