aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-03-02 22:12:02 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:40 +0800
commit498337e8524e1acf9f9471fc8c54038341035911 (patch)
treecae6cdd53705523944e7885b8eb194b0e2863e95 /em-format
parent623f79123688faa67a52076bd00a1e8885ea8023 (diff)
downloadgsoc2013-evolution-498337e8524e1acf9f9471fc8c54038341035911.tar
gsoc2013-evolution-498337e8524e1acf9f9471fc8c54038341035911.tar.gz
gsoc2013-evolution-498337e8524e1acf9f9471fc8c54038341035911.tar.bz2
gsoc2013-evolution-498337e8524e1acf9f9471fc8c54038341035911.tar.lz
gsoc2013-evolution-498337e8524e1acf9f9471fc8c54038341035911.tar.xz
gsoc2013-evolution-498337e8524e1acf9f9471fc8c54038341035911.tar.zst
gsoc2013-evolution-498337e8524e1acf9f9471fc8c54038341035911.zip
Do not leak attachments in a mail view
Diffstat (limited to 'em-format')
-rw-r--r--em-format/em-format.c10
-rw-r--r--em-format/em-format.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 23573331c0..59ae409912 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -150,6 +150,7 @@ emf_finalize (GObject *object)
g_free (emf->charset);
g_free (emf->default_charset);
g_string_free (emf->part_id, TRUE);
+ g_free (emf->current_message_part_id);
g_free (emf->uid);
if (emf->pending_uri_table != NULL)
@@ -240,6 +241,7 @@ emf_format_clone (EMFormat *emf,
emf->message = msg;
}
+ emf->current_message_part_id = g_strdup ("root-message");
g_string_truncate (emf->part_id, 0);
if (folder != NULL)
/* TODO build some string based on the folder name/location? */
@@ -365,6 +367,7 @@ emf_init (EMFormat *emf)
g_queue_init (&emf->header_list);
em_format_default_headers (emf);
emf->part_id = g_string_new("");
+ emf->current_message_part_id = NULL;
emf->validity_found = 0;
shell = e_shell_get_default ();
@@ -2075,12 +2078,16 @@ emf_message_rfc822 (EMFormat *emf,
CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *)part);
const EMFormatHandler *handle;
gint len;
+ gchar *parent_message_part_id;
if (!CAMEL_IS_MIME_MESSAGE (dw)) {
em_format_format_source (emf, stream, part, cancellable);
return;
}
+ parent_message_part_id = emf->current_message_part_id;
+ emf->current_message_part_id = g_strdup (emf->part_id->str);
+
len = emf->part_id->len;
g_string_append_printf(emf->part_id, ".rfc822");
@@ -2091,6 +2098,9 @@ emf_message_rfc822 (EMFormat *emf,
handle, cancellable, FALSE);
g_string_truncate (emf->part_id, len);
+
+ g_free (emf->current_message_part_id);
+ emf->current_message_part_id = parent_message_part_id;
}
static void
diff --git a/em-format/em-format.h b/em-format/em-format.h
index 64336a9aa8..b1f0746fed 100644
--- a/em-format/em-format.h
+++ b/em-format/em-format.h
@@ -198,6 +198,8 @@ struct _EMFormat {
/* Current part ID prefix for identifying parts directly. */
GString *part_id;
+ /* part_id of the currently processing message (when the message has message-attachments) */
+ gchar *current_message_part_id;
/* If empty, then all. */
GQueue header_list;