[evolution-data-server/gnome-3-16] [POP3] Avoid crash on folder dispose, when iterating through pending commands



commit 4caba9a6b6a2a001b67c91041920e75ac989bf91
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 27 19:04:51 2015 +0200

    [POP3] Avoid crash on folder dispose, when iterating through pending commands

 camel/providers/pop3/camel-pop3-engine.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-engine.c b/camel/providers/pop3/camel-pop3-engine.c
index dcbfc38..0dd59c3 100644
--- a/camel/providers/pop3/camel-pop3-engine.c
+++ b/camel/providers/pop3/camel-pop3-engine.c
@@ -370,7 +370,7 @@ camel_pop3_engine_iterate (CamelPOP3Engine *pe,
        }
 
        g_queue_push_tail (&pe->done, pc);
-       pe->sentlen -= strlen (pc->data);
+       pe->sentlen -= pc->data ? strlen (pc->data) : 0;
 
        /* Set next command */
        pe->current = g_queue_pop_head (&pe->active);
@@ -381,14 +381,14 @@ camel_pop3_engine_iterate (CamelPOP3Engine *pe,
        while (link != NULL) {
                pc = (CamelPOP3Command *) link->data;
 
-               if (((pe->capa & CAMEL_POP3_CAP_PIPE) == 0 || (pe->sentlen + strlen (pc->data)) > 
CAMEL_POP3_SEND_LIMIT)
+               if (((pe->capa & CAMEL_POP3_CAP_PIPE) == 0 || (pe->sentlen + (pc->data ? strlen (pc->data) : 
0)) > CAMEL_POP3_SEND_LIMIT)
                    && pe->current != NULL)
                        break;
 
-               if (camel_stream_write ((CamelStream *) pe->stream, pc->data, strlen (pc->data), cancellable, 
error) == -1)
+               if (camel_stream_write ((CamelStream *) pe->stream, pc->data, pc->data ? strlen (pc->data) : 
0, cancellable, error) == -1)
                        goto ioerror;
 
-               pe->sentlen += strlen (pc->data);
+               pe->sentlen += (pc->data ? strlen (pc->data) : 0);
                pc->state = CAMEL_POP3_COMMAND_DISPATCHED;
 
                if (pe->current == NULL)


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