[evolution-data-server] Bug 710361 - GError corruption in imapx_command_fetch_message_done()



commit c0108ea47fd066e0b759c1dcd0b23c2cf9d9058a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Dec 4 17:37:11 2013 -0500

    Bug 710361 - GError corruption in imapx_command_fetch_message_done()
    
    camel_imapx_job_take_error() was being called twice on the same GError.
    The 2nd call freed the GError set in the 1st call, which corrupted the
    memory.  Put a safeguard in camel_imapx_job_take_error() to catch this
    in the future.

 camel/providers/imapx/camel-imapx-job.c    |    1 +
 camel/providers/imapx/camel-imapx-server.c |    7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-job.c b/camel/providers/imapx/camel-imapx-job.c
index f790f54..a5a66cd 100644
--- a/camel/providers/imapx/camel-imapx-job.c
+++ b/camel/providers/imapx/camel-imapx-job.c
@@ -411,6 +411,7 @@ camel_imapx_job_take_error (CamelIMAPXJob *job,
        g_return_if_fail (error != NULL);
 
        real_job = (CamelIMAPXRealJob *) job;
+       g_return_if_fail (real_job->error != error);
 
        g_clear_error (&real_job->error);
 
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 898dff1..81babb7 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -4766,7 +4766,6 @@ imapx_command_fetch_message_done (CamelIMAPXServer *is,
                g_prefix_error (
                        &local_error, "%s: ",
                        _("Error fetching message"));
-               camel_imapx_job_take_error (job, local_error);
                data->body_len = -1;
 
        } else if (data->use_multi_fetch) {
@@ -4863,13 +4862,13 @@ imapx_command_fetch_message_done (CamelIMAPXServer *is,
                g_free (tmp_filename);
        }
 
-       if (local_error != NULL)
-               camel_imapx_job_take_error (job, local_error);
-
        camel_data_cache_remove (data->message_cache, "tmp", data->uid, NULL);
        imapx_unregister_job (is, job);
 
 exit:
+       if (local_error != NULL)
+               camel_imapx_job_take_error (job, local_error);
+
        g_object_unref (mailbox);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]