[Mesa-dev] [PATCH 03/13] mesa/main: Don't go freeing texture data which was never allocated

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Tue Dec 2 06:36:08 PST 2014


Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/main/texstate.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index e0f0852..6f7d781 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -930,8 +930,10 @@ _mesa_free_texture_data(struct gl_context *ctx)
    }
 
    /* Free proxy texture objects */
-   for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++)
-      ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
+   for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
+      if (ctx->Texture.ProxyTex[tgt])
+         ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
+   }
 
    /* GL_ARB_texture_buffer_object */
    _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject, NULL);
-- 
1.8.5.1



More information about the mesa-dev mailing list