]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
send_digest: fix double
authorBaptiste Daroussin <bapt@FreeBSD.org>
Tue, 20 Jun 2023 08:06:34 +0000 (10:06 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Tue, 20 Jun 2023 08:13:46 +0000 (10:13 +0200)
src/send_digest.c

index a66b97b8728843a5c15aa85f7ca5a526cc1f98aa..aeab459777a247f67c209334bd71c1ab0a516300 100644 (file)
@@ -324,7 +324,6 @@ int send_digest(struct ml *ml, int firstindex, int lastindex,
                tmp = unistr_utf8_to_header(tmp);
                xasprintf(&subject, "Subject: %s", tmp);
                free(tmp);
-               free(line);
 
                /* Skip the empty line after the subject */
                line = get_processed_text_line(txt, true, ml);
@@ -334,7 +333,7 @@ int send_digest(struct ml *ml, int firstindex, int lastindex,
                        goto fallback_subject;
                }
 
-               if (line != NULL) free(line);
+               free(line);
                line = NULL;
        } else {
                log_error(LOG_ARGS, "No subject or invalid "
@@ -415,12 +414,12 @@ errdighdrs:
                        line = get_processed_text_line(txt, false, ml);
                        if (line == NULL) break;
                        if(dprintf(fd, "%s\n", line) < 0) {
-                               free(line);
                                log_error(LOG_ARGS, "Could not write"
                                                " std mail");
                                break;
                        }
                        free(line);
+                       line = NULL;
                }
 
                finish_thread_list(tls);