From ba23727169e15e6f297282aba0e014114053c761 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 6 Sep 2010 21:22:56 +0200 Subject: [PATCH] Bug #628651 - memory leak in imapx_append_message() --- camel/providers/imapx/camel-imapx-server.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c index 70beb21..753b9f9 100644 --- a/camel/providers/imapx/camel-imapx-server.c +++ b/camel/providers/imapx/camel-imapx-server.c @@ -5045,6 +5045,7 @@ camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, Cam CamelIMAPXJob *job; CamelMessageInfo *info; gint res; + gboolean success; /* Append just assumes we have no/a dodgy connection. We dump stuff into the 'new' directory, and let the summary know it's there. Then we fire off a no-reply @@ -5060,6 +5061,7 @@ camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, Cam g_io_error_from_errno (errno), _("Cannot create spool file: %s"), g_strerror (errno)); + g_free (uid); return FALSE; } @@ -5075,14 +5077,15 @@ camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, Cam if (res == -1) { g_prefix_error (error, _("Cannot create spool file: ")); camel_data_cache_remove (ifolder->cache, "new", uid, NULL); + g_free (uid); return FALSE; } tmp = camel_data_cache_get_filename (ifolder->cache, "new", uid, NULL); info = camel_folder_summary_info_new_from_message((CamelFolderSummary *)folder->summary, message, NULL); - info->uid = uid; + info->uid = camel_pstring_strdup (uid); ((CamelMessageInfoBase *) info)->flags = ((CamelMessageInfoBase *) mi)->flags; - uid = NULL; + g_free (uid); /* So, we actually just want to let the server loop that messages need appending, i think. This is so the same @@ -5094,10 +5097,15 @@ camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, Cam job->type = IMAPX_JOB_APPEND_MESSAGE; job->start = imapx_job_append_message_start; job->folder = g_object_ref (folder); + job->noreply = FALSE; job->u.append_message.info = info; job->u.append_message.path = tmp; - return imapx_submit_job (is, job, error); + success = imapx_submit_job (is, job, error); + + g_free (job); + + return success; } gboolean -- 2.7.4