Mesa (mesa_7_5_branch): Always free image offsets memory when re-initializing texture image fields .

Michel Dänzer daenzer at kemper.freedesktop.org
Fri Jun 19 16:02:42 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: a120778c72324bc56c63cd0f1873c6f2772228ea
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a120778c72324bc56c63cd0f1873c6f2772228ea

Author: Michel Dänzer <daenzer at vmware.com>
Date:   Fri Jun 19 11:19:08 2009 +0200

Always free image offsets memory when re-initializing texture image fields.

Fixes leak running compiz with direct rendering.

---

 src/mesa/main/mipmap.c                 |    3 ---
 src/mesa/main/teximage.c               |    2 ++
 src/mesa/state_tracker/st_gen_mipmap.c |    3 ---
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 7a71974..b306700 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1598,9 +1598,6 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
          return;
       }
 
-      if (dstImage->ImageOffsets)
-         _mesa_free(dstImage->ImageOffsets);
-
       /* Free old image data */
       if (dstImage->Data)
          ctx->Driver.FreeTexImageData(ctx, dstImage);
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 76b46d7..6e21066 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1250,6 +1250,8 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
     * We allocate the array for 1D/2D textures too in order to avoid special-
     * case code in the texstore routines.
     */
+   if (img->ImageOffsets)
+      _mesa_free(img->ImageOffsets);
    img->ImageOffsets = (GLuint *) _mesa_malloc(depth * sizeof(GLuint));
    for (i = 0; i < depth; i++) {
       img->ImageOffsets[i] = i * width * height;
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index dc6d778..58f6933 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -198,9 +198,6 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
          return;
       }
 
-      if (dstImage->ImageOffsets)
-         _mesa_free(dstImage->ImageOffsets);
-
       /* Free old image data */
       if (dstImage->Data)
          ctx->Driver.FreeTexImageData(ctx, dstImage);




More information about the mesa-commit mailing list