Fix bug 3762, 'redirect fails'
authorwwp <wwp@free.fr>
Wed, 18 Jan 2017 20:48:50 +0000 (21:48 +0100)
committerwwp <wwp@free.fr>
Wed, 18 Jan 2017 20:48:50 +0000 (21:48 +0100)
by removing an check added at 3.14.1.39-g989b3a3, thought I was hardening
sanity checks and I changed the logics, making it fail while in normal
situation. Removed few more extraneous checks.

src/compose.c
src/procheader.c

index 25390c623b8adc523960a00047e54b1a956081cc..07bdeafb54ee06581960f83dd60ebd398f4020ec 100644 (file)
@@ -5543,8 +5543,6 @@ static gint compose_redirect_write_to_file(Compose *compose, FILE *fdest)
                        if (g_ascii_strncasecmp(buf, not_included[i],
                                                strlen(not_included[i])) == 0) {
                                skip = TRUE;
-                               g_free(buf);
-                               buf = NULL;
                                break;
                        }
                }
@@ -5588,7 +5586,7 @@ static gint compose_redirect_write_to_file(Compose *compose, FILE *fdest)
                        goto error;
        }
 
-       if (err || ret == -1)
+       if (err)
                goto error;
 
        if (compose_redirect_write_headers(compose, fdest))
index f09cf9cd9b10da53cae3f50c16b2360f26925b6d..ae54f6e1b1d8039f2a399a170db3f22ff6381c86 100644 (file)
@@ -135,7 +135,7 @@ static gint generic_get_one_field(gchar **bufptr, void *data,
        size_t len;
        gchar *buf;
 
-/*     cm_return_val_if_fail(bufptr != NULL, -1); TODO */
+       cm_return_val_if_fail(bufptr != NULL, -1);
 
        len = BUFFSIZE;
        buf = g_malloc(len);
@@ -269,7 +269,7 @@ GPtrArray *procheader_get_header_array_asis(FILE *fp)
 
        headers = g_ptr_array_new();
 
-       while (procheader_get_one_field_asis(&buf, fp) != -1 && buf != NULL) {
+       while (procheader_get_one_field_asis(&buf, fp) != -1) {
                if ((header = procheader_parse_header(buf)) != NULL)
                        g_ptr_array_add(headers, header);
                g_free(buf);
@@ -390,7 +390,7 @@ void procheader_get_header_fields(FILE *fp, HeaderEntry hentry[])
 
        if (hentry == NULL) return;
 
-       while ((hnum = procheader_get_one_field(&buf, fp, hentry)) != -1 && buf != NULL) {
+       while ((hnum = procheader_get_one_field(&buf, fp, hentry)) != -1) {
                hp = hentry + hnum;
 
                p = buf + strlen(hp->name);
@@ -579,7 +579,7 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
        hentry = procheader_get_headernames(full);
 
        if (MSG_IS_QUEUED(flags) || MSG_IS_DRAFT(flags)) {
-               while (get_one_field(&buf, data, NULL) != -1 && buf != NULL) {
+               while (get_one_field(&buf, data, NULL) != -1) {
                        if ((!strncmp(buf, "X-Claws-End-Special-Headers: 1",
                                strlen("X-Claws-End-Special-Headers:"))) ||
                            (!strncmp(buf, "X-Sylpheed-End-Special-Headers: 1",
@@ -619,7 +619,7 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
                avatar_hook_id = 0;
        }
 
-       while ((hnum = get_one_field(&buf, data, hentry)) != -1 && buf != NULL) {
+       while ((hnum = get_one_field(&buf, data, hentry)) != -1) {
                hp = buf + strlen(hentry[hnum].name);
                while (*hp == ' ' || *hp == '\t') hp++;