diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-14 07:55:46 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-14 07:55:46 +0100 |
commit | 9ea1378d046d764642718f1b070689072bde4601 (patch) | |
tree | b15bce1d35006e79f91cc2a985e7b69a77e0fd3d /builtin/revert.c | |
parent | Merge branch 'kz/merge-tree-merge-base' (diff) | |
parent | built-ins: use free() not UNLEAK() if trivial, rm dead code (diff) | |
download | git-9ea1378d046d764642718f1b070689072bde4601.tar.xz git-9ea1378d046d764642718f1b070689072bde4601.zip |
Merge branch 'ab/various-leak-fixes'
Various leak fixes.
* ab/various-leak-fixes:
built-ins: use free() not UNLEAK() if trivial, rm dead code
revert: fix parse_options_concat() leak
cherry-pick: free "struct replay_opts" members
rebase: don't leak on "--abort"
connected.c: free the "struct packed_git"
sequencer.c: fix "opts->strategy" leak in read_strategy_opts()
ls-files: fix a --with-tree memory leak
revision API: call graph_clear() in release_revisions()
unpack-file: fix ancient leak in create_temp_file()
built-ins & libs & helpers: add/move destructors, fix leaks
dir.c: free "ident" and "exclude_per_dir" in "struct untracked_cache"
read-cache.c: clear and free "sparse_checkout_patterns"
commit: discard partial cache before (re-)reading it
{reset,merge}: call discard_index() before returning
tests: mark tests as passing with SANITIZE=leak
Diffstat (limited to 'builtin/revert.c')
-rw-r--r-- | builtin/revert.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/revert.c b/builtin/revert.c index 6a9b550a61..f2d86d2a8f 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); @@ -261,6 +262,9 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix) opts.action = REPLAY_PICK; sequencer_init_config(&opts); res = run_sequencer(argc, argv, &opts); + if (opts.revs) + release_revisions(opts.revs); + free(opts.revs); if (res < 0) die(_("cherry-pick failed")); return res; |