summaryrefslogtreecommitdiffstats
path: root/http.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2024-09-24 23:59:14 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-25 19:24:55 +0200
commit3d33e96653fecbc692fa5674b127fd598ad2dbeb (patch)
tree6dccd0f695124e5d4f7c0ec7589487a4be663f3d /http.c
parenttransport-helper: fix leak of dummy refs_list (diff)
downloadgit-3d33e96653fecbc692fa5674b127fd598ad2dbeb.tar.xz
git-3d33e96653fecbc692fa5674b127fd598ad2dbeb.zip
http: fix leak when redacting cookies from curl trace
When redacting headers for GIT_TRACE_CURL, we build up a redacted cookie header in a local strbuf, and then copy it into the output. But we forget to release the temporary strbuf, leaking it for every cookie header we show. The other redacted headers don't run into this problem, since they're able to work in-place in the output buffer. But the cookie parsing is too complicated for that, since we redact the cookies individually. This leak is triggered by the cookie tests in t5551. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/http.c b/http.c
index 6c6cc5c822..cc136408c0 100644
--- a/http.c
+++ b/http.c
@@ -800,6 +800,7 @@ static int redact_sensitive_header(struct strbuf *header, size_t offset)
strbuf_setlen(header, sensitive_header - header->buf);
strbuf_addbuf(header, &redacted_header);
+ strbuf_release(&redacted_header);
ret = 1;
}
return ret;