diff options
| author | Vaidas Pilkauskas <vaidas.pilkauskas@shopify.com> | 2026-03-17 13:00:33 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-03-17 09:14:19 -0700 |
| commit | bc6a6cf5eedb19b1b1da92ed2761ff9b1c7da627 (patch) | |
| tree | ee36b0ddfd8d48f295ce4c83b02387be63c11d16 /t/lib-httpd | |
| parent | 67ad42147a7acc2af6074753ebd03d904476118f (diff) | |
| download | git-bc6a6cf5eedb19b1b1da92ed2761ff9b1c7da627.tar.xz | |
strbuf: pass correct alloc to strbuf_attach() in strbuf_reencode()
reencode_string_len() allocates len+1 bytes (including the NUL) and
returns the string length in len. strbuf_reencode() was calling
strbuf_attach(sb, out, len, len), so alloc was one byte too small.
strbuf_attach() then calls strbuf_grow(sb, 0). With alloc < len+1,
ALLOC_GROW always reallocates, so we reallocated immediately after
attach even when the strbuf was not extended further. Pass len+1 as
the alloc argument so the existing buffer is reused and the
reallocation is avoided.
Signed-off-by: Vaidas Pilkauskas <vaidas.pilkauskas@shopify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-httpd')
0 files changed, 0 insertions, 0 deletions
