[evolution-data-server] Fix a memory leak from MH-format camel provider



commit f2613bf075ec25ef878f2505f671c89eb55d3fbe
Author: Milan Crha <mcrha redhat com>
Date:   Thu Sep 13 10:37:54 2012 +0200

    Fix a memory leak from MH-format camel provider

 camel/providers/local/camel-mh-summary.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/local/camel-mh-summary.c b/camel/providers/local/camel-mh-summary.c
index 50e1ace..dd22b17 100644
--- a/camel/providers/local/camel-mh-summary.c
+++ b/camel/providers/local/camel-mh-summary.c
@@ -254,7 +254,13 @@ mh_summary_check (CamelLocalSummary *cls,
 			if (info == NULL || (cls->index && (!camel_index_has_name (cls->index, d->d_name)))) {
 				/* need to add this file to the summary */
 				if (info != NULL) {
-					g_hash_table_remove (left, camel_message_info_uid (info));
+					CamelMessageInfo *old = g_hash_table_lookup (left, camel_message_info_uid (info));
+
+					if (old) {
+						g_hash_table_remove (left, camel_message_info_uid (info));
+						camel_message_info_free (old);
+					}
+
 					camel_folder_summary_remove ((CamelFolderSummary *) cls, info);
 					camel_message_info_free (info);
 				}
@@ -264,8 +270,8 @@ mh_summary_check (CamelLocalSummary *cls,
 				CamelMessageInfo *old = g_hash_table_lookup (left, uid);
 
 				if (old) {
-					camel_message_info_free (old);
 					g_hash_table_remove (left, uid);
+					camel_message_info_free (old);
 				}
 				camel_message_info_free (info);
 			}
@@ -331,6 +337,8 @@ mh_summary_sync (CamelLocalSummary *cls,
 		camel_message_info_free (info);
 	}
 
+	camel_folder_summary_free_array (known_uids);
+
 	/* Chain up to parent's sync() method. */
 	local_summary_class = CAMEL_LOCAL_SUMMARY_CLASS (camel_mh_summary_parent_class);
 	return local_summary_class->sync (cls, expunge, changes, cancellable, error);



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