return;
}
- head = &ctx->AttribStack[ctx->AttribStackDepth];
+ head = ctx->AttribStack[ctx->AttribStackDepth];
+ if (unlikely(!head)) {
+ head = CALLOC_STRUCT(gl_attrib_node);
+ if (unlikely(!head)) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
+ return;
+ }
+ ctx->AttribStack[ctx->AttribStackDepth] = head;
+ }
head->Mask = mask;
if (mask & GL_ACCUM_BUFFER_BIT)
}
ctx->AttribStackDepth--;
- attr = &ctx->AttribStack[ctx->AttribStackDepth];
+ attr = ctx->AttribStack[ctx->AttribStackDepth];
unsigned mask = attr->Mask;
struct gl_attrib_node *attr;
ctx->AttribStackDepth--;
- attr = &ctx->AttribStack[ctx->AttribStackDepth];
+ attr = ctx->AttribStack[ctx->AttribStackDepth];
if (attr->Mask & GL_TEXTURE_BIT)
_mesa_reference_shared_state(ctx, &attr->Texture.SharedRef, NULL);
}
+
+ for (unsigned i = 0; i < ARRAY_SIZE(ctx->AttribStack); i++)
+ free(ctx->AttribStack[i]);
}
/** \name State attribute stack (for glPush/PopAttrib) */
/*@{*/
GLuint AttribStackDepth;
- struct gl_attrib_node AttribStack[MAX_ATTRIB_STACK_DEPTH];
+ struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH];
/*@}*/
/** \name Renderer attribute groups