Commit 05cff7923c00929f241ebd8d580f1250e1f73bee

Sam Lantinga 2014-08-24T00:02:12

Fixed bug 2699 - possible memory leak in GL_RenderReadPixels Benoit Pierre If glReadPixels returns an error, than the temporary buffer is not deallocated

1
2
3
4
5
6
7
8
9
10
11
12
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;
     }