[Mesa-dev] [PATCH] Fix generate_mipmap_compressed memory leaks.

Vinson Lee vlee at freedesktop.org
Thu Jul 25 22:30:48 PDT 2013


Fixes "Resource leak" defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/mesa/main/mipmap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 5839632..0ef6536 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -2128,6 +2128,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
       if (!dstImage) {
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
          free(temp_dst);
+         free(temp_src_slices);
+         free(temp_dst_slices);
          return;
       }
 
@@ -2154,6 +2156,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
                                       border, srcImage->InternalFormat,
                                       srcImage->TexFormat)) {
          free(temp_dst);
+         free(temp_src_slices);
+         free(temp_dst_slices);
          return;
       }
 
-- 
1.8.3.2



More information about the mesa-dev mailing list