From de1f4885ddb1eb510bc9796a008f7a38a105e598 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 23 Jun 2010 17:10:03 +0100 Subject: [PATCH] material: Avoid possibly reading invalid memory in _cogl_material_prune_empty_layer_difference we sometimes unref the given layer before dereferencing it to get a pointer to its parent. This defers the unref until after we have fetched the parent pointer. --- cogl/cogl-material.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogl/cogl-material.c b/cogl/cogl-material.c index 6ddcefb68..36716c339 100644 --- a/cogl/cogl-material.c +++ b/cogl/cogl-material.c @@ -1941,8 +1941,8 @@ _cogl_material_prune_empty_layer_difference (CoglMaterial *layers_authority, if (layer_parent->index == layer->index && layer_parent->owner == NULL) { cogl_handle_ref (layer_parent); - cogl_handle_unref (layer); link->data = layer->parent; + cogl_handle_unref (layer); recursively_free_layer_caches (layers_authority); return; }