Skip to content

Commit a09efb7

Browse files
pks-tgitster
authored andcommitted
builtin/send-pack: fix leaking refspecs
We never free data associated with the assembled refspec in git-send-pack(1), causing a memory leak. Fix this. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ca52234 commit a09efb7

File tree

6 files changed

+9
-0
lines changed

6 files changed

+9
-0
lines changed

builtin/send-pack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,5 +338,6 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
338338

339339
free_refs(remote_refs);
340340
free_refs(local_refs);
341+
refspec_clear(&rs);
341342
return ret;
342343
}

t/t5400-send-pack.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ test_description='See why rewinding head breaks send-pack
99
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
1010
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1111

12+
TEST_PASSES_SANITIZE_LEAK=true
1213
. ./test-lib.sh
1314

1415
cnt=64

t/t5401-update-hooks.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#
55

66
test_description='Test the update hook infrastructure.'
7+
8+
TEST_PASSES_SANITIZE_LEAK=true
79
. ./test-lib.sh
810

911
test_expect_success setup '

t/t5408-send-pack-stdin.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='send-pack --stdin tests'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57

68
create_ref () {

t/t5548-push-porcelain.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55
test_description='Test git push porcelain output'
66

7+
TEST_PASSES_SANITIZE_LEAK=true
78
. ./test-lib.sh
89

910
# Create commits in <repo> and assign each commit's oid to shell variables

t/t5812-proto-disable-http.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='test disabling of git-over-http in clone/fetch'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57
. "$TEST_DIRECTORY/lib-proto-disable.sh"
68
. "$TEST_DIRECTORY/lib-httpd.sh"

0 commit comments

Comments
 (0)