aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-03-02 22:12:02 +0800
committerMilan Crha <mcrha@redhat.com>2011-03-02 22:13:40 +0800
commit2533e52b8cf543eed874d220a3f039eebe67253e (patch)
tree20b018e5f1b86200982fd7bb324aef3358469070 /em-format
parenta0854ec1a6591ea10ba7915f37684f78f476fcd4 (diff)
downloadgsoc2013-evolution-2533e52b8cf543eed874d220a3f039eebe67253e.tar
gsoc2013-evolution-2533e52b8cf543eed874d220a3f039eebe67253e.tar.gz
gsoc2013-evolution-2533e52b8cf543eed874d220a3f039eebe67253e.tar.bz2
gsoc2013-evolution-2533e52b8cf543eed874d220a3f039eebe67253e.tar.lz
gsoc2013-evolution-2533e52b8cf543eed874d220a3f039eebe67253e.tar.xz
gsoc2013-evolution-2533e52b8cf543eed874d220a3f039eebe67253e.tar.zst
gsoc2013-evolution-2533e52b8cf543eed874d220a3f039eebe67253e.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;