On 07/25/2013 11:30 PM, Vinson Lee wrote:
Fixes "Resource leak" defects reported by Coverity.

Signed-off-by: Vinson Lee <v...@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;
        }

Hi Vinson,

Thanks for cleaning up after me. I used valgrind to check for memory leaks when I made those changes, but of course, that doesn't usually catch the error paths.

I think we can do this cleanup a little cleaner with a "goto end". I'll post a patch for that. Could you then retest it with Coverity?

-Brian

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to