From: Junio C Hamano Date: Wed, 22 Feb 2023 22:55:45 +0000 (-0800) Subject: Merge branch 'ab/various-leak-fixes' X-Git-Tag: v2.40.0-rc0~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72972ea0b978f20b335339d18e497da617398967;p=thirdparty%2Fgit.git Merge branch 'ab/various-leak-fixes' Leak fixes. * ab/various-leak-fixes: push: free_refs() the "local_refs" in set_refspecs() push: refactor refspec_append_mapped() for subsequent leak-fix receive-pack: release the linked "struct command *" list grep API: plug memory leaks by freeing "header_list" grep.c: refactor free_grep_patterns() builtin/merge.c: free "&buf" on "Your local changes..." error builtin/merge.c: use fixed strings, not "strbuf", fix leak show-branch: free() allocated "head" before return commit-graph: fix a parse_options_concat() leak http-backend.c: fix cmd_main() memory leak, refactor reg{exec,free}() http-backend.c: fix "dir" and "cmd_arg" leaks in cmd_main() worktree: fix a trivial leak in prune_worktrees() repack: fix leaks on error with "goto cleanup" name-rev: don't xstrdup() an already dup'd string various: add missing clear_pathspec(), fix leaks clone: use free() instead of UNLEAK() commit-graph: use free_commit_graph() instead of UNLEAK() bundle.c: don't leak the "args" in the "struct child_process" tests: mark tests as passing with SANITIZE=leak --- 72972ea0b978f20b335339d18e497da617398967 diff --cc builtin/reset.c index 4b59aa9aea,e9c10618cd..0697fa89de --- a/builtin/reset.c +++ b/builtin/reset.c @@@ -391,8 -390,8 +391,9 @@@ int cmd_reset(int argc, const char **ar if (reset_type != NONE) die(_("options '%s' and '%s' cannot be used together"), "--patch", "--{hard,mixed,soft}"); trace2_cmd_mode("patch-interactive"); - return !!run_add_p(the_repository, ADD_P_RESET, rev, - update_ref_status = run_add_interactive(rev, "--patch=reset", &pathspec); ++ update_ref_status = !!run_add_p(the_repository, ADD_P_RESET, rev, + &pathspec); + goto cleanup; } /* git reset tree [--] paths... can be used to