Skip to content

Commit e00e1cf

Browse files
peffgitster
authored andcommitted
transport-helper: fix strbuf leak in push_refs_with_push()
We loop over the refs to push, building up a strbuf with the set of "push" directives to send to the remote helper. But if the atomic-push flag is set and we hit a rejected ref, we'll bail from the function early. We clean up most things, but forgot to release the strbuf. Fixing this lets us mark t5541 as leak-free. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 05372c2 commit e00e1cf

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

t/t5541-http-push-smart.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ test_description='test smart pushing over http via http-backend'
77
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
88
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
99

10+
TEST_PASSES_SANITIZE_LEAK=true
1011
. ./test-lib.sh
1112

1213
ROOT_PATH="$PWD"

transport-helper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ static int push_refs_with_push(struct transport *transport,
10231023
if (atomic) {
10241024
reject_atomic_push(remote_refs, mirror);
10251025
string_list_clear(&cas_options, 0);
1026+
strbuf_release(&buf);
10261027
return 0;
10271028
} else
10281029
continue;

0 commit comments

Comments
 (0)