1
0
mirror of https://github.com/git/git synced 2024-06-28 13:44:40 +00:00

submodule: fix leaking memory for submodule entries

In `free_one_config()` we never end up freeing the `url` and `ignore`
fields and thus leak memory. Fix those leaks and mark now-passing tests
as leak free.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-05-27 13:46:59 +02:00 committed by Junio C Hamano
parent ba9d029445
commit 3ef52dd112
5 changed files with 6 additions and 0 deletions

View File

@ -91,6 +91,8 @@ static void free_one_config(struct submodule_entry *entry)
free((void *) entry->config->path);
free((void *) entry->config->name);
free((void *) entry->config->branch);
free((void *) entry->config->url);
free((void *) entry->config->ignore);
free((void *) entry->config->update_strategy.command);
free(entry->config);
}

View File

@ -2,6 +2,7 @@
test_description='read-tree can handle submodules'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh

View File

@ -2,6 +2,7 @@
test_description='checkout can handle submodules'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh

View File

@ -6,6 +6,7 @@ This test verifies the recurse-submodules feature correctly lists files from
submodules.
'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup directory structure and submodules' '

View File

@ -2,6 +2,7 @@
test_description='reset can handle submodules'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh