[Xfce4-commits] r26264 - xfdesktop/branches/xfce_4_4/modules/menu

Brian Tarricone kelnos at xfce.org
Wed Nov 7 06:44:49 CET 2007


Author: kelnos
Date: 2007-11-07 05:44:49 +0000 (Wed, 07 Nov 2007)
New Revision: 26264

Modified:
   xfdesktop/branches/xfce_4_4/modules/menu/desktop-menuspec.c
Log:
fix possible memleak (unlikely tho)


Modified: xfdesktop/branches/xfce_4_4/modules/menu/desktop-menuspec.c
===================================================================
--- xfdesktop/branches/xfce_4_4/modules/menu/desktop-menuspec.c	2007-11-06 22:53:58 UTC (rev 26263)
+++ xfdesktop/branches/xfce_4_4/modules/menu/desktop-menuspec.c	2007-11-07 05:44:49 UTC (rev 26264)
@@ -242,6 +242,15 @@
 }
 
 static void
+orphan_ht_free_data(gpointer key,
+                    gpointer value,
+                    gpointer data)
+{
+    g_free((gchar *)key);
+    g_node_destroy((GNode *)value);
+}
+
+static void
 menuspec_xml_start(GMarkupParseContext *context, const gchar *element_name,
         const gchar **attribute_names, const gchar **attribute_values,
         gpointer user_data, GError **error)
@@ -460,7 +469,11 @@
     g_hash_table_destroy(cats_orphans);
     cats_orphans = NULL;
     
-    cleanup:
+cleanup:
+    if(cats_orphans) {
+        g_hash_table_foreach(cats_orphans, orphan_ht_free_data, NULL);
+        g_hash_table_destroy(cats_orphans);
+    }
     
     if(gpcontext)
         g_markup_parse_context_free(gpcontext);



More information about the Xfce4-commits mailing list