Skip to content

Commit fa0f27a

Browse files
pks-tgitster
authored andcommitted
submodule: fix leaking seen submodule names
We keep track of submodules we have already seen via a string map such that we don't process the same submodule twice. We never free that map though, causing a memory leak. Fix this leak by clearing the map. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1a7e5ef commit fa0f27a

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

submodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,6 +1880,7 @@ int fetch_submodules(struct repository *r,
18801880
strvec_clear(&spf.args);
18811881
out:
18821882
free_submodules_data(&spf.changed_submodule_names);
1883+
string_list_clear(&spf.seen_submodule_names, 0);
18831884
return spf.result;
18841885
}
18851886

t/t5572-pull-submodule.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test_description='pull can handle submodules'
55
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
66
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
77

8+
TEST_PASSES_SANITIZE_LEAK=true
89
. ./test-lib.sh
910
. "$TEST_DIRECTORY"/lib-submodule-update.sh
1011

t/t7418-submodule-sparse-gitmodules.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ also by committing .gitmodules and then just removing it from the filesystem.
1515
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
1616
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
1717

18+
TEST_PASSES_SANITIZE_LEAK=true
1819
. ./test-lib.sh
1920

2021
test_expect_success 'setup' '

0 commit comments

Comments
 (0)