mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
merge-ort: unconditionally release attributes index
We conditionally release the index used for reading gitattributes in merge-ort based on whether or the index has been populated. This check uses `cache_nr` as a condition. This isn't sufficient though, as the variable may be zero even when some other parts of the index have been populated. This leads to memory leaks when sparse checkouts are in use, as we may not end up releasing the sparse checkout patterns. Fix this issue by unconditionally releasing the index. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
a0b82622cb
commit
de54b450a3
@@ -689,8 +689,7 @@ static void clear_or_reinit_internal_opts(struct merge_options_internal *opti,
|
|||||||
*/
|
*/
|
||||||
strmap_clear_func(&opti->conflicted, 0);
|
strmap_clear_func(&opti->conflicted, 0);
|
||||||
|
|
||||||
if (opti->attr_index.cache_nr) /* true iff opt->renormalize */
|
discard_index(&opti->attr_index);
|
||||||
discard_index(&opti->attr_index);
|
|
||||||
|
|
||||||
/* Free memory used by various renames maps */
|
/* Free memory used by various renames maps */
|
||||||
for (i = MERGE_SIDE1; i <= MERGE_SIDE2; ++i) {
|
for (i = MERGE_SIDE1; i <= MERGE_SIDE2; ++i) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
|||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
TEST_CREATE_REPO_NO_TEMPLATE=1
|
TEST_CREATE_REPO_NO_TEMPLATE=1
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
pristine_detach () {
|
pristine_detach () {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ test_description="limiting blob downloads when merging with partial clones"
|
|||||||
# underscore notation is to differentiate different
|
# underscore notation is to differentiate different
|
||||||
# files that might be renamed into each other's paths.)
|
# files that might be renamed into each other's paths.)
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-merge.sh
|
. "$TEST_DIRECTORY"/lib-merge.sh
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ test_description="merge cases"
|
|||||||
# underscore notation is to differentiate different
|
# underscore notation is to differentiate different
|
||||||
# files that might be renamed into each other's paths.)
|
# files that might be renamed into each other's paths.)
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-merge.sh
|
. "$TEST_DIRECTORY"/lib-merge.sh
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ should leave the following structure in the working tree:
|
|||||||
But note that sub2 should have the SKIP_WORKTREE bit set.
|
But note that sub2 should have the SKIP_WORKTREE bit set.
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|||||||
Reference in New Issue
Block a user