Skip to content

Commit 6bd9c55

Browse files
committed
win32/sendmail.c/SendText(): move string duplication code to a more logical place
1 parent f1a8944 commit 6bd9c55

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

win32/sendmail.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,15 +571,13 @@ static int SendText(char *RPath, const char *Subject, const char *mailTo, const
571571
which would look like "\r\n\r\n". */
572572
memcpy(stripped_header + (pos1 - ZSTR_VAL(headers) - 4), pos2 + 2, strlen(pos2) - 2);
573573
}
574+
} else {
575+
/* Simplify the code that we create a copy of stripped_header no matter if
576+
we actually strip something or not. So we've a single efree() later. */
577+
stripped_header = estrndup(ZSTR_VAL(headers), ZSTR_LEN(headers));
574578
}
575579
}
576580

577-
/* Simplify the code that we create a copy of stripped_header no matter if
578-
we actually strip something or not. So we've a single efree() later. */
579-
if (headers && !stripped_header) {
580-
stripped_header = estrndup(ZSTR_VAL(headers), ZSTR_LEN(headers));
581-
}
582-
583581
if (!Post("DATA\r\n")) {
584582
if (stripped_header) {
585583
efree(stripped_header);

0 commit comments

Comments
 (0)