From cb834c65eca5989886f117ae3adfc224e4dbd8d3 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 17 Nov 2009 21:20:46 +0100 Subject: [PATCH] don't leak GNodes in plist_free Before recursing over its children, plist_free_node started by detaching the current GNode from its parent which means that calling g_node_destroy on the root of the tree was freeing only the top-level GNode while what was intended was to free the whole tree. Don't leak memory by not detaching children GNodes from their parents so that g_node_destroy on the toplevel GNode can clean everything. --- src/plist.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/plist.c b/src/plist.c index ed83e3c..39e4e83 100644 --- a/src/plist.c +++ b/src/plist.c @@ -72,6 +72,7 @@ static void plist_free_node(GNode * node, gpointer none) plist_free_data(data); node->data = NULL; g_node_children_foreach(node, G_TRAVERSE_ALL, plist_free_node, NULL); + g_node_destroy(node); } plist_t plist_new_dict(void) -- 1.6.5.2