From: Phillip Wood Date: Sat, 31 Dec 2022 14:55:54 GMT Subject: Re: [PATCH 05/10] builtin/revert.c: fix common leak by using replay_opts_release() Message-ID: In-Reply-To: <3a823d76-9ea3-d6a0-c9ed-9e84fe57042c@web.de> On 30/12/2022 23:37, René Scharfe wrote: > Am 30.12.22 um 08:28 schrieb Ævar Arnfjörð Bjarmason: >> Use the replay_opts_release() function introduced in a preceding >> commit to fix a memory leak in run_sequencer(). >> >> Signed-off-by: Ævar Arnfjörð Bjarmason >> --- >> builtin/revert.c | 1 + >> t/t3419-rebase-patch-id.sh | 1 + >> t/t3425-rebase-topology-merges.sh | 2 ++ >> t/t3501-revert-cherry-pick.sh | 1 + >> t/t3502-cherry-pick-merge.sh | 1 + >> t/t3503-cherry-pick-root.sh | 1 + >> t/t3506-cherry-pick-ff.sh | 1 + >> t/t3511-cherry-pick-x.sh | 1 + >> 8 files changed, 9 insertions(+) >> >> diff --git a/builtin/revert.c b/builtin/revert.c >> index e956d125a2b..2f656b25619 100644 >> --- a/builtin/revert.c >> +++ b/builtin/revert.c >> @@ -240,6 +240,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts) >> cmd == 's' ? sequencer_skip : >> sequencer_pick_revisions; >> ret = cbfun(the_repository, opts); >> + replay_opts_release(opts); > > Is this the right place for this call? opts is passed in by this function's > two callers. They should clean it up instead, no? That would add one line, > but avoid the need for patch 4. Would make patch 6 easier to read as well. Yes I agree that would be a better approach. Best Wishes Phillip >> return ret; >> } >> >> diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh >> index 7181f176b81..6c61f240cf9 100755 >> --- a/t/t3419-rebase-patch-id.sh >> +++ b/t/t3419-rebase-patch-id.sh >> @@ -5,6 +5,7 @@ test_description='git rebase - test patch id computation' >> GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main >> export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME >> >> +TEST_PASSES_SANITIZE_LEAK=true >> . ./test-lib.sh >> >> scramble () { >> diff --git a/t/t3425-rebase-topology-merges.sh b/t/t3425-rebase-topology-merges.sh >> index 63acc1ea4da..a16428bdf54 100755 >> --- a/t/t3425-rebase-topology-merges.sh >> +++ b/t/t3425-rebase-topology-merges.sh >> @@ -1,6 +1,8 @@ >> #!/bin/sh >> >> test_description='rebase topology tests with merges' >> + >> +TEST_PASSES_SANITIZE_LEAK=true >> . ./test-lib.sh >> . "$TEST_DIRECTORY"/lib-rebase.sh >> >> diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh >> index 1f4cfc37449..2f3e3e24169 100755 >> --- a/t/t3501-revert-cherry-pick.sh >> +++ b/t/t3501-revert-cherry-pick.sh >> @@ -13,6 +13,7 @@ test_description='test cherry-pick and revert with renames >> 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 ' >> diff --git a/t/t3502-cherry-pick-merge.sh b/t/t3502-cherry-pick-merge.sh >> index 5495eacfec1..1b2c0d6aca6 100755 >> --- a/t/t3502-cherry-pick-merge.sh >> +++ b/t/t3502-cherry-pick-merge.sh >> @@ -11,6 +11,7 @@ test_description='cherry picking and reverting a merge >> 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 ' >> diff --git a/t/t3503-cherry-pick-root.sh b/t/t3503-cherry-pick-root.sh >> index 95fe4feaeee..76d393dc8a3 100755 >> --- a/t/t3503-cherry-pick-root.sh >> +++ b/t/t3503-cherry-pick-root.sh >> @@ -5,6 +5,7 @@ test_description='test cherry-picking (and reverting) a root commit' >> 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 ' >> diff --git a/t/t3506-cherry-pick-ff.sh b/t/t3506-cherry-pick-ff.sh >> index 7e11bd4a4c5..b71bad17b85 100755 >> --- a/t/t3506-cherry-pick-ff.sh >> +++ b/t/t3506-cherry-pick-ff.sh >> @@ -5,6 +5,7 @@ test_description='test cherry-picking with --ff option' >> 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 ' >> diff --git a/t/t3511-cherry-pick-x.sh b/t/t3511-cherry-pick-x.sh >> index 84a587daf3a..dd5d92ef302 100755 >> --- a/t/t3511-cherry-pick-x.sh >> +++ b/t/t3511-cherry-pick-x.sh >> @@ -2,6 +2,7 @@ >> >> test_description='Test cherry-pick -x and -s' >> >> +TEST_PASSES_SANITIZE_LEAK=true >> . ./test-lib.sh >> >> pristine_detach () { >