stack: don't deref freed mem in _cogl_memory_stack_free
This fixes _cogl_memory_stack_free to ensure we don't dereference freed memory as we iterate the sub-stacks to free them. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 1d27fedef9c599aa9976b809f18e0da1913cec26)
This commit is contained in:
parent
df51574116
commit
56382435fa
@ -177,10 +177,9 @@ _cogl_memory_stack_free (CoglMemoryStack *stack)
|
|||||||
{
|
{
|
||||||
CoglMemorySubStack *sub_stack;
|
CoglMemorySubStack *sub_stack;
|
||||||
|
|
||||||
for (sub_stack = stack->sub_stacks.tqh_first;
|
while ((sub_stack = COGL_TAILQ_FIRST (&stack->sub_stacks)))
|
||||||
sub_stack;
|
|
||||||
sub_stack = sub_stack->list_node.tqe_next)
|
|
||||||
{
|
{
|
||||||
|
COGL_TAILQ_REMOVE (&stack->sub_stacks, sub_stack, list_node);
|
||||||
_cogl_memory_sub_stack_free (sub_stack);
|
_cogl_memory_sub_stack_free (sub_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user