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>
Patrick Steinhardt committed
Sep 5, 2024 at 12:08 UTC
3eefd348e5865b0406d32194a157ae77d9a7939b
2 files changed
+3
submodule.c
+2
@@ -1883,6 +1883,8 @@ int fetch_submodules(struct repository *r,
1883
out:
1884
free_submodules_data(&spf.changed_submodule_names);
1885
string_list_clear(&spf.seen_submodule_names, 0);
1886
+ strbuf_release(&spf.submodules_with_errors);
1887
+ free(spf.oid_fetch_tasks);
1888
return spf.result;
1889
}
1890
t/t5526-fetch-submodules.sh
+1
@@ -6,6 +6,7 @@ test_description='Recursive "git fetch" for submodules'
6
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
7
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
8
9
+TEST_PASSES_SANITIZE_LEAK=true
10
. ./test-lib.sh
11
12
pwd=$(pwd)