[evolution-data-server/gnome-3-10] Bug 710361 - GError corruption in imapx_command_fetch_message_done()



commit 6b3765b89cd5164d894d6717cd328d18bc411593
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Dec 4 17:31:17 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/camel-imapx-job.c    |    1 +
 camel/camel-imapx-server.c |    7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/camel/camel-imapx-job.c b/camel/camel-imapx-job.c
index 49c3988..4b59418 100644
--- a/camel/camel-imapx-job.c
+++ b/camel/camel-imapx-job.c
@@ -412,6 +412,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/camel-imapx-server.c b/camel/camel-imapx-server.c
index dedbb4a..f514a6a 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -4384,7 +4384,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) {
@@ -4477,13 +4476,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 (ifolder->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 (folder);
 }
 


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