[evolution-data-server] Bug #672837 - Crash in camel_pop3_engine_command_free



commit b75c9169bf4bd4276eb9b031b41dc8f70528d1fd
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 31 18:47:06 2013 +0200

    Bug #672837 - Crash in camel_pop3_engine_command_free

 camel/providers/pop3/camel-pop3-engine.c |    2 ++
 camel/providers/pop3/camel-pop3-store.c  |   18 ++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-engine.c b/camel/providers/pop3/camel-pop3-engine.c
index 44aa4c3..fd66cd9 100644
--- a/camel/providers/pop3/camel-pop3-engine.c
+++ b/camel/providers/pop3/camel-pop3-engine.c
@@ -458,6 +458,8 @@ void
 camel_pop3_engine_command_free (CamelPOP3Engine *pe,
                                 CamelPOP3Command *pc)
 {
+       g_return_if_fail (pc != NULL);
+
        if (pe && pe->current != pc)
                g_queue_remove (&pe->done, pc);
        g_free (pc->error_str);
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 8890c47..e5d2d1d 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -569,14 +569,16 @@ pop3_store_disconnect_sync (CamelService *service,
 
                pop3_engine = camel_pop3_store_ref_engine (store);
 
-               pc = camel_pop3_engine_command_new (
-                       pop3_engine, 0, NULL, NULL,
-                       cancellable, error, "QUIT\r\n");
-               while (camel_pop3_engine_iterate (pop3_engine, NULL, cancellable, NULL) > 0)
-                       ;
-               camel_pop3_engine_command_free (pop3_engine, pc);
-
-               g_clear_object (&pop3_engine);
+               if (pop3_engine) {
+                       pc = camel_pop3_engine_command_new (
+                               pop3_engine, 0, NULL, NULL,
+                               cancellable, error, "QUIT\r\n");
+                       while (camel_pop3_engine_iterate (pop3_engine, NULL, cancellable, NULL) > 0)
+                               ;
+                       camel_pop3_engine_command_free (pop3_engine, pc);
+
+                       g_clear_object (&pop3_engine);
+               }
        }
 
        /* Chain up to parent's disconnect() method. */


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