receive-pack: release the linked "struct command *" list
Fix a memory leak that's been with us since this code was introduced in [1]. Later in [2] we started using FLEX_ALLOC_MEM() to allocate the "struct command *". 1.575f497456
(Add first cut at "git-receive-pack", 2005-06-29) 2.eb1af2df0b
(git-receive-pack: start parsing ref update commands, 2005-06-29) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
fb2ebe72a3
commit
1fdd31cf52
@ -2032,6 +2032,16 @@ static struct command **queue_command(struct command **tail,
|
||||
return &cmd->next;
|
||||
}
|
||||
|
||||
static void free_commands(struct command *commands)
|
||||
{
|
||||
while (commands) {
|
||||
struct command *next = commands->next;
|
||||
|
||||
free(commands);
|
||||
commands = next;
|
||||
}
|
||||
}
|
||||
|
||||
static void queue_commands_from_cert(struct command **tail,
|
||||
struct strbuf *push_cert)
|
||||
{
|
||||
@ -2569,6 +2579,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
|
||||
run_receive_hook(commands, "post-receive", 1,
|
||||
&push_options);
|
||||
run_update_post_hook(commands);
|
||||
free_commands(commands);
|
||||
string_list_clear(&push_options, 0);
|
||||
if (auto_gc) {
|
||||
struct child_process proc = CHILD_PROCESS_INIT;
|
||||
|
@ -5,6 +5,7 @@ test_description='forced push to replace commit we do not have'
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success setup '
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
test_description='remote push rejects are reported by client'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'setup' '
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='check environment showed to remote side of transports'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'set up "remote" push situation' '
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
test_description='pulling from symlinked subdir'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
# The scenario we are building:
|
||||
|
@ -4,6 +4,7 @@ test_description='test fetching of oddly-named refs'
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
# afterwards we will have:
|
||||
|
@ -4,6 +4,7 @@ test_description='test git-http-backend-noserver'
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
HTTPD_DOCUMENT_ROOT_PATH="$TRASH_DIRECTORY"
|
||||
|
@ -4,6 +4,7 @@ test_description='test git-http-backend'
|
||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-httpd.sh
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='test git-http-backend respects CONTENT_LENGTH'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
test_lazy_prereq GZIP 'gzip --version'
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
test_description='session ID in capabilities'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
REPO="$(pwd)/repo"
|
||||
|
Loading…
Reference in New Issue
Block a user