diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2023-02-06 20:08:08 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-02-06 16:03:52 -0800 |
| commit | 9ff2f0606915cf76fc4865bddf639fd5fd2cba29 (patch) | |
| tree | 148786a6b70ef1df91d9e08bc77dfad6169c4f11 /t/t9106-git-svn-commit-diff-clobber.sh | |
| parent | 6a09c3a9a69fa2059383dd94294bbfd44b440d4b (diff) | |
sequencer API users: fix get_replay_opts() leaks
Make the replay_opts_release() function added in the preceding commit
non-static, and use it for freeing the "struct replay_opts"
constructed for "rebase" and "revert".
To safely call our new replay_opts_release() we'll need to stop
calling it in sequencer_remove_state(), and instead call it where we
allocate the "struct replay_opts" itself.
This is because in e.g. do_interactive_rebase() we construct a "struct
replay_opts" with "get_replay_opts()", and then call
"complete_action()". If we get far enough in that function without
encountering errors we'll call "pick_commits()" which (indirectly)
calls sequencer_remove_state() at the end.
But if we encounter errors anywhere along the way we'd punt out early,
and not free() the memory we allocated. Remembering whether we
previously called sequencer_remove_state() would be a hassle.
Using a FREE_AND_NULL() pattern would also work, as it would be safe
to call replay_opts_release() repeatedly. But let's fix this properly
instead, by having the owner of the data free() it.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9106-git-svn-commit-diff-clobber.sh')
| -rwxr-xr-x | t/t9106-git-svn-commit-diff-clobber.sh | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh index 3cab0b9720..bca496c40e 100755 --- a/t/t9106-git-svn-commit-diff-clobber.sh +++ b/t/t9106-git-svn-commit-diff-clobber.sh @@ -3,7 +3,6 @@ # Copyright (c) 2006 Eric Wong test_description='git svn commit-diff clobber' -TEST_FAILS_SANITIZE_LEAK=true . ./lib-git-svn.sh test_expect_success 'initialize repo' ' |
