From 0bf42e41c8b63fc2488dd8d41f696310b5a5a6a7 Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Fri, 10 Jun 2016 05:30:00 -0600 Subject: libutils/mipmap.c: Fixed possible memory leak In case of malloc() failure memory allocated for both 'srcImage' and 'dstImage' is leaked. Patch simplified by Brian Paul. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96480 Signed-off-by: Amarnath Valluri Reviewed-by: Brian Paul --- src/libutil/mipmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libutil/mipmap.c b/src/libutil/mipmap.c index c475c96..483c3fe 100644 --- a/src/libutil/mipmap.c +++ b/src/libutil/mipmap.c @@ -4509,6 +4509,8 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(srcImage); + free(dstImage); return GLU_OUT_OF_MEMORY; } -- cgit v1.2.1