diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-11-08 21:17:50 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-11-21 06:32:48 +0300 |
commit | 603f2f5719f8a85996d5f20cf0e56186c149b923 (patch) | |
tree | 7ca62e018a6d91bdeb989dfeea6c7bdde2be2659 /builtin/revert.c | |
parent | d1ec656d68fe6dfc421a5c96d009fbd2e1fa76f3 (diff) |
revert: fix parse_options_concat() leak
Free memory from parse_options_concat(), which comes from code
originally added (then extended) in [1].
At this point we could get several more tests leak-free by free()-ing
the xstrdup() just above the line being changed, but that one's
trickier than it seems. The sequencer_remove_state() function
supposedly owns it, but sometimes we don't call it. I have a fix for
it, but it's non-trivial, so let's fix the easy one first.
1. c62f6ec341b (revert: add --ff option to allow fast forward when
cherry-picking, 2010-03-06)
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'builtin/revert.c')
-rw-r--r-- | builtin/revert.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/revert.c b/builtin/revert.c index 0f81c8a795..8bc87e4c77 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -221,6 +221,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts) opts->strategy = xstrdup_or_null(opts->strategy); if (!opts->strategy && getenv("GIT_TEST_MERGE_ALGORITHM")) opts->strategy = xstrdup(getenv("GIT_TEST_MERGE_ALGORITHM")); + free(options); if (cmd == 'q') { int ret = sequencer_remove_state(opts); |