fix another memory leak
authorDana Jansens <danakj@orodu.net>
Wed, 11 Nov 2009 20:19:35 +0000 (15:19 -0500)
committerDana Jansens <danakj@orodu.net>
Thu, 12 Nov 2009 22:21:09 +0000 (17:21 -0500)
glib/gtree.c

index f4e3bb6bf893d5a0e83fc5a10078ebd6519cfed9..511748bc68c4bb146eda124cedcfd3ffc155d56a 100644 (file)
@@ -1296,11 +1296,21 @@ g_tree_remove_internal (GTree         *tree,
     }
   else
     {
+      /* make a new version of the parent to cut the child off.
+         making a new version of the parent may make a new version of
+         the node being deleted, which is the one we'd want to free then
+         instead, so update the node pointer */
       parent = g_tree_node_next_version (tree, parent);
       if (is_leftchild)
+        {
+          node = parent->v[0].left;
           parent->v[0].left = NULL;
+        }
       else
+        {
+          node = parent->v[0].right;
           parent->v[0].right = NULL;
+        }
     }
 
   tree->nnodes--;