From: Milan Crha Date: Thu, 13 Sep 2012 08:37:54 +0000 (+0200) Subject: Fix a memory leak from MH-format camel provider X-Git-Tag: upstream/3.7.4~447 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f2613bf075ec25ef878f2505f671c89eb55d3fbe;p=platform%2Fupstream%2Fevolution-data-server.git Fix a memory leak from MH-format camel provider --- 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);