[evolution-exchange/gnome-2-30] Bug #620815 - Memory leaks with Evolution



commit 488a8ee52eb381e401e6dd62c548b75fe9ed6052
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 24 20:45:10 2010 +0200

    Bug #620815 - Memory leaks with Evolution

 camel/camel-exchange-folder.c  |   18 +++---------------
 camel/camel-exchange-summary.c |    2 +-
 2 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/camel/camel-exchange-folder.c b/camel/camel-exchange-folder.c
index 79737a0..5d1db84 100644
--- a/camel/camel-exchange-folder.c
+++ b/camel/camel-exchange-folder.c
@@ -125,22 +125,12 @@ init (CamelFolder *folder)
 }
 
 static void
-free_index_and_mid (gpointer thread_index, gpointer message_id, gpointer d)
-{
-	g_free (thread_index);
-	g_free (message_id);
-}
-
-static void
 finalize (CamelExchangeFolder *exch)
 {
 	camel_object_unref (CAMEL_OBJECT (exch->cache));
 
-	if (exch->thread_index_to_message_id) {
-		g_hash_table_foreach (exch->thread_index_to_message_id,
-				      free_index_and_mid, NULL);
+	if (exch->thread_index_to_message_id)
 		g_hash_table_destroy (exch->thread_index_to_message_id);
-	}
 	g_free (exch->source);
 }
 
@@ -818,8 +808,6 @@ camel_exchange_folder_remove_message (CamelExchangeFolder *exch,
 						  einfo->thread_index,
 						  &key, &value)) {
 			g_hash_table_remove (exch->thread_index_to_message_id, key);
-			g_free (key);
-			g_free (value);
 		}
 	}
 
@@ -1033,7 +1021,7 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
 	camel_object_state_read (folder);
 
 	exch->thread_index_to_message_id =
-		g_hash_table_new (g_str_hash, g_str_equal);
+		g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
 	len = camel_folder_summary_count (folder->summary);
 	for (i = 0; i < len; i++) {
@@ -1064,7 +1052,7 @@ camel_exchange_folder_construct (CamelFolder *folder, CamelStore *parent,
 			camel_folder_summary_reload_from_db (folder->summary, ex);
 
 		for (i = 0; i < summary->len; i++) {
-			uids->pdata[i] = g_strdup(summary->pdata[i]);
+			uids->pdata[i] = summary->pdata[i];
 			info = camel_folder_summary_uid (folder->summary, uids->pdata[i]);
 			flags->data[i] = ((CamelMessageInfoBase *)info)->flags & CAMEL_EXCHANGE_SERVER_FLAGS;
 			hrefs->pdata[i] = ((CamelExchangeMessageInfo *)info)->href;
diff --git a/camel/camel-exchange-summary.c b/camel/camel-exchange-summary.c
index 8d7a15f..8a5c5a2 100644
--- a/camel/camel-exchange-summary.c
+++ b/camel/camel-exchange-summary.c
@@ -256,7 +256,7 @@ message_info_from_db (CamelFolderSummary *s, CamelMIRecord *mir)
 
 	info = CAMEL_FOLDER_SUMMARY_CLASS(parent_class)->message_info_from_db (s, mir);
 	if (info) {
-		gchar *part = g_strdup (mir->bdata);
+		gchar *part = mir->bdata;
 		gint len;
 		einfo = (CamelExchangeMessageInfo *)info;
 		EXTRACT_FIRST_STRING (einfo->thread_index)



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