Fixed two memory leaks around procheader_get_one_field().
authorAndrej Kacian <ticho@claws-mail.org>
Sun, 16 Jul 2017 17:22:23 +0000 (19:22 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Sun, 16 Jul 2017 17:22:23 +0000 (19:22 +0200)
src/procheader.c
src/procmsg.c

index 3277740..6d5132d 100644 (file)
@@ -574,8 +574,11 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
                        if ((!strncmp(buf, "X-Claws-End-Special-Headers: 1",
                                strlen("X-Claws-End-Special-Headers:"))) ||
                            (!strncmp(buf, "X-Sylpheed-End-Special-Headers: 1",
-                               strlen("X-Sylpheed-End-Special-Headers:"))))
+                               strlen("X-Sylpheed-End-Special-Headers:")))) {
+                               g_free(buf);
+                               buf = NULL;
                                break;
+                       }
                        /* from other mailers */
                        if (!strncmp(buf, "Date: ", 6)
                        ||  !strncmp(buf, "To: ", 4)
index c9b077e..3137f5f 100644 (file)
@@ -1604,10 +1604,11 @@ static gint procmsg_send_message_queue_full(const gchar *file, gboolean keep_ses
                case Q_CLAWS_HDRS:
                case Q_CLAWS_HDRS_OLD:
                        /* end of special headers reached */
+                       g_free(buf);
                        goto send_mail; /* can't "break;break;" */
                }
+               g_free(buf);
        }
-       g_free(buf);
 
 send_mail:
        filepos = ftell(fp);