Skip to content

Commit 3d33e96

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cb2732f commit 3d33e96

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

http.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@ static int redact_sensitive_header(struct strbuf *header, size_t offset)
800800

801801
strbuf_setlen(header, sensitive_header - header->buf);
802802
strbuf_addbuf(header, &redacted_header);
803+
strbuf_release(&redacted_header);
803804
ret = 1;
804805
}
805806
return ret;

0 commit comments

Comments
 (0)