[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 May 5 04:25:19 PDT 2015


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 1af9d47..d133104 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -936,8 +936,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