summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2009-06-19 11:19:08 +0200
committerMichel Dänzer <[email protected]>2009-06-19 18:00:33 +0200
commita120778c72324bc56c63cd0f1873c6f2772228ea (patch)
treeb27c04704115354cc4eca66bd17eeb1b538c1fe0 /src/mesa/main
parent3cf92e936afbef91b856f064742f1bc2ad9e601a (diff)
Always free image offsets memory when re-initializing texture image fields.
Fixes leak running compiz with direct rendering.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mipmap.c3
-rw-r--r--src/mesa/main/teximage.c2
2 files changed, 2 insertions, 3 deletions
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 7a719745fcc..b3067004842 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 76b46d700b5..6e21066537b 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;