aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-09-12 19:53:56 +0800
committerMilan Crha <mcrha@redhat.com>2012-09-12 19:53:56 +0800
commitb0eca85eb4d12fef1f5857c280ba13fb925c0bfc (patch)
tree928f3a09b69a77adb212b1d3a78191052e5d662a
parentea33b6c60d56bbe23f8e5def7e237fcadfdbc46b (diff)
downloadgsoc2013-evolution-b0eca85eb4d12fef1f5857c280ba13fb925c0bfc.tar.gz
gsoc2013-evolution-b0eca85eb4d12fef1f5857c280ba13fb925c0bfc.tar.zst
gsoc2013-evolution-b0eca85eb4d12fef1f5857c280ba13fb925c0bfc.zip
Fix a memory leak when replying to a message
-rw-r--r--mail/e-mail-reader-utils.c3
-rw-r--r--mail/em-utils.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 6f0a9822ce..4ce1afbbb3 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -1271,6 +1271,7 @@ mail_reader_reply_message_parsed (GObject *object,
context->reply_type, context->reply_style,
part_list, context->address);
+ g_object_unref (part_list);
async_context_free (context);
}
@@ -1396,10 +1397,12 @@ e_mail_reader_reply_to_message (EMailReader *reader,
g_object_ref (src_message);
g_object_unref (part_list);
+ part_list = NULL;
g_return_if_fail (src_message != NULL);
} else {
g_object_unref (part_list);
+ part_list = NULL;
}
if (!e_web_view_is_selection_active (web_view))
diff --git a/mail/em-utils.c b/mail/em-utils.c
index a5e8c0534e..f7f12e5755 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1290,7 +1290,7 @@ em_utils_message_to_html (CamelSession *session,
guint32 *validity_found)
{
EMailFormatter *formatter;
- EMailParser *parser;
+ EMailParser *parser = NULL;
CamelStream *mem;
GByteArray *buf;
EShell *shell;
@@ -1328,6 +1328,8 @@ em_utils_message_to_html (CamelSession *session,
parser = e_mail_parser_new (session);
parts_list = e_mail_parser_parse_sync (parser, NULL, NULL, message, NULL);
+ } else {
+ g_object_ref (parts_list);
}
/* Return all found validities and possibly show hidden prefer-plain part */
@@ -1362,6 +1364,10 @@ em_utils_message_to_html (CamelSession *session,
if (hidden_text_html_part)
hidden_text_html_part->is_hidden = TRUE;
+ g_object_unref (parts_list);
+ if (parser)
+ g_object_unref (parser);
+
if (append && *append)
camel_stream_write_string (mem, append, NULL, NULL);