Skip to content

Commit 3eefd34

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac2e7d5 commit 3eefd34

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

submodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,6 +1883,8 @@ int fetch_submodules(struct repository *r,
18831883
out:
18841884
free_submodules_data(&spf.changed_submodule_names);
18851885
string_list_clear(&spf.seen_submodule_names, 0);
1886+
strbuf_release(&spf.submodules_with_errors);
1887+
free(spf.oid_fetch_tasks);
18861888
return spf.result;
18871889
}
18881890

t/t5526-fetch-submodules.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ test_description='Recursive "git fetch" for submodules'
66
GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB=1
77
export GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB
88

9+
TEST_PASSES_SANITIZE_LEAK=true
910
. ./test-lib.sh
1011

1112
pwd=$(pwd)

0 commit comments

Comments
 (0)