stack: don't deref freed mem in _cogl_memory_stack_free
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 <822ec91a7ef82248fd36162ca8ac3283eba70848@linux.intel.com>

gcampax/cogl,djdeath/cogl-android,djdeath/cogl,gcampax/cogl,djdeath/cogl,djdeath/cogl-android,gcampax/cogl,djdeath/cogl-android,djdeath/cogl,gcampax/cogl