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
  ...
This commit is contained in:
Junio C Hamano
2024-10-02 07:46:25 -07:00
50 changed files with 279 additions and 124 deletions

View File

@ -85,7 +85,7 @@ static const char *opt_squash;
static const char *opt_commit;
static const char *opt_edit;
static const char *cleanup_arg;
static const char *opt_ff;
static char *opt_ff;
static const char *opt_verify_signatures;
static const char *opt_verify;
static int opt_autostash = -1;
@ -1028,8 +1028,10 @@ int cmd_pull(int argc,
* "--rebase" can override a config setting of
* pull.ff=only.
*/
if (opt_rebase >= 0 && opt_ff && !strcmp(opt_ff, "--ff-only"))
opt_ff = "--ff";
if (opt_rebase >= 0 && opt_ff && !strcmp(opt_ff, "--ff-only")) {
free(opt_ff);
opt_ff = xstrdup("--ff");
}
}
if (opt_rebase < 0)
@ -1139,7 +1141,8 @@ int cmd_pull(int argc,
if (can_ff) {
/* we can fast-forward this without invoking rebase */
opt_ff = "--ff-only";
free(opt_ff);
opt_ff = xstrdup("--ff-only");
ret = run_merge();
} else {
ret = run_rebase(&newbase, &upstream);