diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2002-10-10 14:11:33 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2002-10-10 14:11:33 +0000 |
commit | d7e237cbb514ab0a4c2f892aa613725f5f0fd7d4 (patch) | |
tree | 492596366ccd53292dfa8fada1de1132ce189505 | |
parent | 967c74697aa59072b9c647d04a4c59913e66b7ce (diff) |
check texImage->IsClientData before freeing memory
-rw-r--r-- | src/mesa/main/teximage.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 43bd1877de..871df601e9 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.104.2.13 2002/10/02 17:24:40 brianp Exp $ */ +/* $Id: teximage.c,v 1.104.2.14 2002/10/10 14:11:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -392,7 +392,7 @@ _mesa_alloc_texture_image( void ) void _mesa_free_texture_image( struct gl_texture_image *teximage ) { - if (teximage->Data) { + if (teximage->Data && !teximage->IsClientData) { MESA_PBUFFER_FREE( teximage->Data ); teximage->Data = NULL; } @@ -1537,11 +1537,11 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); @@ -1664,11 +1664,11 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, postConvHeight, @@ -1789,10 +1789,10 @@ _mesa_TexImage3D( GLenum target, GLint level, GLenum internalFormat, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); @@ -2058,11 +2058,11 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, @@ -2122,11 +2122,11 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { /* free the old texture data */ MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; clear_teximage_fields(texImage); /* not really needed, but helpful */ _mesa_init_teximage_fields(ctx, target, texImage, @@ -2309,10 +2309,10 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); @@ -2410,10 +2410,10 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); @@ -2508,10 +2508,10 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, return; } } - else if (texImage->Data) { + else if (texImage->Data && !texImage->IsClientData) { MESA_PBUFFER_FREE(texImage->Data); - texImage->Data = NULL; } + texImage->Data = NULL; _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); |