From: Junio C Hamano Date: Wed, 2 Oct 2024 14:46:25 +0000 (-0700) Subject: Merge branch 'ps/leakfixes-part-7' X-Git-Tag: v2.47.0-rc1~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=365529e1ea19b44a7a253b780f3ae3a1cb2f081f;p=thirdparty%2Fgit.git Merge branch 'ps/leakfixes-part-7' More leak-fixes. * ps/leakfixes-part-7: (23 commits) diffcore-break: fix leaking filespecs when merging broken pairs revision: fix leaking parents when simplifying commits builtin/maintenance: fix leak in `get_schedule_cmd()` builtin/maintenance: fix leaking config string promisor-remote: fix leaking partial clone filter grep: fix leaking grep pattern submodule: fix leaking submodule ODB paths trace2: destroy context stored in thread-local storage builtin/difftool: plug several trivial memory leaks builtin/repack: fix leaking configuration diffcore-order: fix leaking buffer when parsing orderfiles parse-options: free previous value of `OPTION_FILENAME` diff: fix leaking orderfile option builtin/pull: fix leaking "ff" option dir: fix off by one errors for ignored and untracked entries builtin/submodule--helper: fix leaking remote ref on errors t/helper: fix leaking subrepo in nested submodule config helper builtin/submodule--helper: fix leaking error buffer builtin/submodule--helper: clear child process when not running it submodule: fix leaking update strategy ... --- 365529e1ea19b44a7a253b780f3ae3a1cb2f081f diff --cc builtin/gc.c index 7da6d1966b,b68a0be62c..6a7a2da006 --- a/builtin/gc.c +++ b/builtin/gc.c @@@ -2169,10 -2137,10 +2177,10 @@@ static int schtasks_schedule_task(cons struct strbuf tfilename = STRBUF_INIT; int minute = get_random_minute(); - get_schedule_cmd(&cmd, NULL); + get_schedule_cmd("schtasks", NULL, &cmd); strbuf_addf(&tfilename, "%s/schedule_%s_XXXXXX", - get_git_common_dir(), frequency); + repo_get_common_dir(the_repository), frequency); tfile = xmks_tempfile(tfilename.buf); strbuf_release(&tfilename); diff --cc git.c index 2fbea24ec9,3c7fabfda2..2a9752c91c --- a/git.c +++ b/git.c @@@ -735,9 -745,15 +745,15 @@@ static void handle_builtin(int argc, co } builtin = get_builtin(cmd); - if (builtin) - exit(run_builtin(builtin, argc, argv, the_repository)); + if (builtin) { - int ret = run_builtin(builtin, argc, argv); ++ int ret = run_builtin(builtin, argc, argv, the_repository); + strvec_clear(&args); + free(argv_copy); + exit(ret); + } + strvec_clear(&args); + free(argv_copy); } static void execv_dashed_external(const char **argv)