[evolution-data-server] Fix leak in camel_folder_info_build()
- From: Jonathon Jongsma <jjongsma src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Fix leak in camel_folder_info_build()
- Date: Wed, 20 Jan 2010 21:57:52 +0000 (UTC)
commit 66dc931bf41ab754b4a14da101e4a5fd47fe3515
Author: Jonathon Jongsma <jonathon quotidian org>
Date: Fri Nov 6 10:37:02 2009 -0600
Fix leak in camel_folder_info_build()
All of the folders were added to a hash table with a non-strduped string as a
key, but then if the parent folder was missing, we created a new folderinfo for
the parent and inserted that into the hash table with a strduped key. So when
the hash table was destroyed, the 'fake' parent folder keys were leaked. To fix
this, I created the hash table with g_hash_table_new_full() which would g_free()
the keys and then always strduped the key.
https://bugzilla.gnome.org/show_bug.cgi?id=607588
camel/camel-store.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 9b8d26f..54ccac2 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -1043,10 +1043,10 @@ camel_folder_info_build (GPtrArray *folders, const gchar *namespace,
qsort (folders->pdata, folders->len, sizeof (folders->pdata[0]), folder_info_cmp);
/* Hash the folders. */
- hash = g_hash_table_new (g_str_hash, g_str_equal);
+ hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
for (i = 0; i < folders->len; i++) {
fi = folders->pdata[i];
- g_hash_table_insert (hash, fi->full_name, fi);
+ g_hash_table_insert (hash, g_strdup (fi->full_name), fi);
}
/* Now find parents. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]