Gitweb:
https://git.exim.org/exim.git/commitdiff/4729b6937b582a029147ba51298f5c300c5b1891
Commit: 4729b6937b582a029147ba51298f5c300c5b1891
Parent: ee3c2fea18d0c940c2256c6bf041f546c703c375
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Mar 14 15:51:18 2021 +0000
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Sat Mar 20 00:17:40 2021 +0000
Avoid needless alloc for null header
---
src/src/header.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/src/header.c b/src/src/header.c
index cf7a812..720446b 100644
--- a/src/src/header.c
+++ b/src/src/header.c
@@ -97,12 +97,15 @@ header_add_backend(BOOL after, uschar *name, BOOL topnot, int type,
header_line *h, *new = NULL;
header_line **hptr;
-uschar *p, *q;
-uschar * buf = store_get(HEADER_ADD_BUFFER_SIZE, FALSE);
-gstring gs = { .size = HEADER_ADD_BUFFER_SIZE, .ptr = 0, .s = buf };
+uschar * p, * q, * buf;
+gstring gs;
if (!header_last) return NULL;
+gs.s = buf = store_get(HEADER_ADD_BUFFER_SIZE, FALSE);
+gs.size = HEADER_ADD_BUFFER_SIZE;
+gs.ptr = 0;
+
if (!string_vformat(&gs, SVFMT_REBUFFER, format, ap))
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "string too long in header_add: "
"%.100s ...", string_from_gstring(&gs));