mirror of
https://github.com/git/git
synced 2024-09-29 21:27:13 +00:00
revision: fix leaking parents when simplifying commits
When simplifying commits, e.g. because they are treesame with their parents, we unset the commit's parent pointers but never free them. Plug the resulting memory leaks. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b6c3f8e12c
commit
fa016423c7
|
@ -1071,7 +1071,11 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
|||
ts->treesame[nth_parent] = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
free_commit_list(parent->next);
|
||||
parent->next = NULL;
|
||||
while (commit->parents != parent)
|
||||
pop_commit(&commit->parents);
|
||||
commit->parents = parent;
|
||||
|
||||
/*
|
||||
|
@ -1103,6 +1107,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
|||
die("cannot simplify commit %s (invalid %s)",
|
||||
oid_to_hex(&commit->object.oid),
|
||||
oid_to_hex(&p->object.oid));
|
||||
free_commit_list(p->parents);
|
||||
p->parents = NULL;
|
||||
}
|
||||
/* fallthrough */
|
||||
|
|
|
@ -4,6 +4,7 @@ test_description='various tests of reflog walk (log -g) behavior'
|
|||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'set up some reflog entries' '
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
test_description='exercise basic bitmap functionality'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-bitmap.sh
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
test_description='exercise basic multi-pack bitmap functionality'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
. "${TEST_DIRECTORY}/lib-bitmap.sh"
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ test_description='git rev-list trivial path optimization test
|
|||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success setup '
|
||||
|
|
|
@ -29,6 +29,7 @@ test_description='--ancestry-path'
|
|||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
test_merge () {
|
||||
|
|
|
@ -16,6 +16,7 @@ test_description='TREESAME and limiting'
|
|||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
note () {
|
||||
|
|
Loading…
Reference in a new issue