Skip to content

Commit 0c10ed1

Browse files
avargitster
authored andcommitted
commit.c: free() revs.commit in get_fork_point()
Fix a memory leak that's been with us since d96855f (merge-base: teach "--fork-point" mode, 2013-10-23). Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a535040 commit 0c10ed1

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

commit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
10331033
ret = bases->item;
10341034

10351035
cleanup_return:
1036+
free(revs.commit);
10361037
free_commit_list(bases);
10371038
free(full_refname);
10381039
return ret;

t/t3431-rebase-fork-point.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_description='git rebase --fork-point test'
88
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
99
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1010

11+
TEST_PASSES_SANITIZE_LEAK=true
1112
. ./test-lib.sh
1213

1314
# A---B---D---E (main)

t/t3432-rebase-fast-forward.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_description='ensure rebase fast-forwards commits when possible'
88
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
99
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1010

11+
TEST_PASSES_SANITIZE_LEAK=true
1112
. ./test-lib.sh
1213

1314
test_expect_success setup '

0 commit comments

Comments
 (0)