glib r7617 - in branches/glib-2-18: . gio



Author: chpe
Date: Mon Oct 20 16:50:17 2008
New Revision: 7617
URL: http://svn.gnome.org/viewvc/glib?rev=7617&view=rev

Log:
Bug 557087 â mem leak in g_content_types_get_registered

Modified:
   branches/glib-2-18/ChangeLog
   branches/glib-2-18/gio/gcontenttype.c

Modified: branches/glib-2-18/gio/gcontenttype.c
==============================================================================
--- branches/glib-2-18/gio/gcontenttype.c	(original)
+++ branches/glib-2-18/gio/gcontenttype.c	Mon Oct 20 16:50:17 2008
@@ -998,7 +998,7 @@
 	  if (g_str_has_suffix (ent->d_name, ".xml"))
 	    {
 	      mimetype = g_strdup_printf ("%s/%.*s", prefix, (int) strlen (ent->d_name) - 4, ent->d_name);
-	      g_hash_table_insert (mimetypes, mimetype, NULL);
+	      g_hash_table_replace (mimetypes, mimetype, NULL);
 	    }
 	}
       closedir (d);
@@ -1053,7 +1053,7 @@
   int i;
   GList *l;
 
-  mimetypes = g_hash_table_new (g_str_hash, g_str_equal);
+  mimetypes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 
   enumerate_mimetypes_dir (g_get_user_data_dir (), mimetypes);
   dirs = g_get_system_data_dirs ();
@@ -1064,7 +1064,10 @@
   l = NULL;
   g_hash_table_iter_init (&iter, mimetypes);
   while (g_hash_table_iter_next (&iter, &key, NULL))
-    l = g_list_prepend (l, key);
+    {
+      l = g_list_prepend (l, key);
+      g_hash_table_iter_steal (&iter);
+    }
 
   g_hash_table_destroy (mimetypes);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]