From: Jose Dapena Paz Date: Mon, 27 Jul 2009 15:47:50 +0000 (+0200) Subject: Avoid using an already freed string for content id X-Git-Tag: 3.0.17-rc26~8 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=ad35bb9cb28319c235ca94b707c09f087409f783 Avoid using an already freed string for content id * src/modest-tny-msg.c (add_attachments): get a copy of old content id intead of a plain reference, as this may be freed before we use it for the new attachment. --- diff --git a/src/modest-tny-msg.c b/src/modest-tny-msg.c index b7de9db..3c17ced 100644 --- a/src/modest-tny-msg.c +++ b/src/modest-tny-msg.c @@ -334,8 +334,8 @@ add_attachments (TnyMimePart *part, GList *attachments_list, gboolean add_inline old_attachment = pos->data; if (!tny_mime_part_is_purged (old_attachment)) { - const gchar *old_cid; - old_cid = tny_mime_part_get_content_id (old_attachment); + gchar *old_cid; + old_cid = g_strdup (tny_mime_part_get_content_id (old_attachment)); attachment_part = copy_mime_part (old_attachment, err); if (attachment_part != NULL) { if (add_inline) { @@ -359,6 +359,7 @@ add_attachments (TnyMimePart *part, GList *attachments_list, gboolean add_inline tny_mime_part_set_content_id (attachment_part, old_cid); g_object_unref (attachment_part); } + g_free (old_cid); } } return attached;