mesa: protect against double-free in _vbo_DestroyContext()
authorBrian Paul <brian.paul@tungstengraphics.com>
Tue, 16 Sep 2008 14:49:43 +0000 (08:49 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Tue, 16 Sep 2008 14:51:56 +0000 (08:51 -0600)
src/mesa/vbo/vbo_context.c

index dc7c534251e225844fc1cd56b3784fe326bf5aee..b452ac8a38e2ef1f057f81a72fb54533f6b49d58 100644 (file)
@@ -246,12 +246,14 @@ void _vbo_DestroyContext( GLcontext *ctx )
       ctx->aelt_context = NULL;
    }
 
-   vbo_exec_destroy(ctx);
+   if (vbo_context(ctx)) {
+      vbo_exec_destroy(ctx);
 #if FEATURE_dlist
-   vbo_save_destroy(ctx);
+      vbo_save_destroy(ctx);
 #endif
-   FREE(vbo_context(ctx));
-   ctx->swtnl_im = NULL;
+      FREE(vbo_context(ctx));
+      ctx->swtnl_im = NULL;
+   }
 }