[evolution-data-server/gnome-3-8] Bug #656488 - imapx: Memory leak of mi->server_user_flags



commit d3e1fe4060015aa1aac4bfe730a49f0de05b3c38
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 25 14:42:20 2013 +0100

    Bug #656488 - imapx: Memory leak of mi->server_user_flags

 camel/camel-imapx-server.c  |    3 +++
 camel/camel-imapx-summary.c |   17 +++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 6d0893f..b185aea 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -2324,6 +2324,9 @@ imapx_untagged_bye (CamelIMAPXServer *is,
                        error, CAMEL_IMAPX_ERROR, 1,
                        "IMAP server said BYE: %s", token);
        }
+
+       g_free (token);
+
        is->state = IMAPX_SHUTDOWN;
 
        return FALSE;
diff --git a/camel/camel-imapx-summary.c b/camel/camel-imapx-summary.c
index 0656380..c0042c7 100644
--- a/camel/camel-imapx-summary.c
+++ b/camel/camel-imapx-summary.c
@@ -63,6 +63,11 @@ imapx_message_info_clone (CamelFolderSummary *s,
 
        to = (CamelIMAPXMessageInfo *)
                folder_summary_class->message_info_clone (s, mi);
+       if (from->server_user_flags) {
+               CamelIMAPXMessageInfo *xfrom = (CamelIMAPXMessageInfo *) from;
+
+               camel_flag_list_copy (&to->server_user_flags, &xfrom->server_user_flags);
+       }
        to->server_flags = from->server_flags;
 
        /* FIXME: parent clone should do this */
@@ -72,6 +77,17 @@ imapx_message_info_clone (CamelFolderSummary *s,
 }
 
 static void
+imapx_message_info_free (CamelFolderSummary *summary,
+                        CamelMessageInfo *mi)
+{
+       CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) mi;
+
+       camel_flag_list_free (&xinfo->server_user_flags);
+
+       CAMEL_FOLDER_SUMMARY_CLASS (camel_imapx_summary_parent_class)->message_info_free (summary, mi);
+}
+
+static void
 camel_imapx_summary_class_init (CamelIMAPXSummaryClass *class)
 {
        CamelFolderSummaryClass *folder_summary_class;
@@ -80,6 +96,7 @@ camel_imapx_summary_class_init (CamelIMAPXSummaryClass *class)
        folder_summary_class->message_info_size = sizeof (CamelIMAPXMessageInfo);
        folder_summary_class->content_info_size = sizeof (CamelIMAPXMessageContentInfo);
        folder_summary_class->message_info_clone = imapx_message_info_clone;
+       folder_summary_class->message_info_free = imapx_message_info_free;
        folder_summary_class->summary_header_to_db = summary_header_to_db;
        folder_summary_class->summary_header_from_db = summary_header_from_db;
        folder_summary_class->message_info_to_db = message_info_to_db;


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