submodule: fix leaking fetch task data

The `submodule_parallel_fetch` structure contains various data
structures that we use to set up parallel fetches of submodules. We do
not free some of its data though, causing memory leaks. Plug those.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Patrick Steinhardt 2024-09-05 12:08:53 +02:00 committed by Junio C Hamano
parent ac2e7d545e
commit 3eefd348e5
2 changed files with 3 additions and 0 deletions

View File

@ -1883,6 +1883,8 @@ int fetch_submodules(struct repository *r,
out:
free_submodules_data(&spf.changed_submodule_names);
string_list_clear(&spf.seen_submodule_names, 0);
strbuf_release(&spf.submodules_with_errors);
free(spf.oid_fetch_tasks);
return spf.result;
}


View File

@ -6,6 +6,7 @@ test_description='Recursive "git fetch" for submodules'
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

pwd=$(pwd)