From 6bd9c555eed1a1e5963a0b5144f83ef3878f9d2d Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Fri, 26 Dec 2025 00:58:51 +0100 Subject: [PATCH] win32/sendmail.c/SendText(): move string duplication code to a more logical place --- win32/sendmail.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/win32/sendmail.c b/win32/sendmail.c index 3a32f3e4f0d..2b72ae328e0 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -571,15 +571,13 @@ static int SendText(char *RPath, const char *Subject, const char *mailTo, const which would look like "\r\n\r\n". */ memcpy(stripped_header + (pos1 - ZSTR_VAL(headers) - 4), pos2 + 2, strlen(pos2) - 2); } + } else { + /* Simplify the code that we create a copy of stripped_header no matter if + we actually strip something or not. So we've a single efree() later. */ + stripped_header = estrndup(ZSTR_VAL(headers), ZSTR_LEN(headers)); } } - /* Simplify the code that we create a copy of stripped_header no matter if - we actually strip something or not. So we've a single efree() later. */ - if (headers && !stripped_header) { - stripped_header = estrndup(ZSTR_VAL(headers), ZSTR_LEN(headers)); - } - if (!Post("DATA\r\n")) { if (stripped_header) { efree(stripped_header);