Browse Source

commit.c: free() revs.commit in get_fork_point()

Fix a memory leak that's been with us since d96855ff51 (merge-base:
teach "--fork-point" mode, 2013-10-23).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Ævar Arnfjörð Bjarmason 2 years ago committed by Junio C Hamano
parent
commit
0c10ed19c4
  1. 1
      commit.c
  2. 1
      t/t3431-rebase-fork-point.sh
  3. 1
      t/t3432-rebase-fast-forward.sh

1
commit.c

@ -1033,6 +1033,7 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
ret = bases->item; ret = bases->item;


cleanup_return: cleanup_return:
free(revs.commit);
free_commit_list(bases); free_commit_list(bases);
free(full_refname); free(full_refname);
return ret; return ret;

1
t/t3431-rebase-fork-point.sh

@ -8,6 +8,7 @@ test_description='git rebase --fork-point test'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


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

1
t/t3432-rebase-fast-forward.sh

@ -8,6 +8,7 @@ test_description='ensure rebase fast-forwards commits when possible'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME


TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh . ./test-lib.sh


test_expect_success setup ' test_expect_success setup '

Loading…
Cancel
Save