Skip to content

Commit 8ff6bd4

Browse files
pks-tgitster
authored andcommitted
merge-recursive: fix memory leak when finalizing merge
We do not free some members of `struct merge_options`' private data. Fix this to plug those leaks. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3199b22 commit 8ff6bd4

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

merge-recursive.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3800,6 +3800,9 @@ static void merge_finalize(struct merge_options *opt)
38003800
if (show(opt, 2))
38013801
diff_warn_rename_limit("merge.renamelimit",
38023802
opt->priv->needed_rename_limit, 0);
3803+
hashmap_clear_and_free(&opt->priv->current_file_dir_set,
3804+
struct path_hashmap_entry, e);
3805+
string_list_clear(&opt->priv->df_conflict_file_set, 0);
38033806
FREE_AND_NULL(opt->priv);
38043807
}
38053808

t/t1004-read-tree-m-u-wf.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ test_description='read-tree -m -u checks working tree files'
55
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

8+
TEST_PASSES_SANITIZE_LEAK=true
89
. ./test-lib.sh
910
. "$TEST_DIRECTORY"/lib-read-tree.sh
1011

t/t1015-read-index-unmerged.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22

33
test_description='Test various callers of read_index_unmerged'
4+
5+
TEST_PASSES_SANITIZE_LEAK=true
46
. ./test-lib.sh
57

68
test_expect_success 'setup modify/delete + directory/file conflict' '

t/t3509-cherry-pick-merge-df.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ test_description='Test cherry-pick with directory/file conflicts'
44
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
55
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
66

7+
TEST_PASSES_SANITIZE_LEAK=true
78
. ./test-lib.sh
89

910
test_expect_success 'Initialize repository' '

0 commit comments

Comments
 (0)