]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule: fix leaking fetch task data
authorPatrick Steinhardt <ps@pks.im>
Thu, 5 Sep 2024 10:08:53 +0000 (12:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2024 15:49:11 +0000 (08:49 -0700)
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>
submodule.c
t/t5526-fetch-submodules.sh

index 97516b0fec10d8c5f0df1b5d13b108d26b5b5a3f..97d0d47b561fa42a982f613e7bae7105b56d4fab 100644 (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;
 }
 
index 5e566205ba4b95830bd97c97b0092cb4a3356304..2cfb5bd6bb1e8698e53d56d35b8b759cecb58c49 100755 (executable)
@@ -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)