mesa: Allow setting GL_TEXTURE_MAX_LEVEL to 0 with GL_TEXTURE_RECTANGLE.
[mesa.git] / src / mesa / main / errors.c
index 8ec6a8c33b8dcaa98b75403fb99da4bdfed64b79..9151718eab6c45491950d2df54bc39f37372037d 100644 (file)
@@ -969,7 +969,7 @@ _mesa_init_errors(struct gl_context *ctx)
 
 /**
  * Loop through debug group stack tearing down states for
- * filtering debug messages.
+ * filtering debug messages.  Then free debug output state.
  */
 void
 _mesa_free_errors_data(struct gl_context *ctx)
@@ -980,6 +980,9 @@ _mesa_free_errors_data(struct gl_context *ctx)
       for (i = 0; i <= ctx->Debug->GroupStackDepth; i++) {
          free_errors_data(ctx, i);
       }
+      FREE(ctx->Debug);
+      /* set to NULL just in case it is used before context is completely gone. */
+      ctx->Debug = NULL;
    }
 }