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

6
dir.c
View File

@ -2136,8 +2136,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
*/
state = path_none;
} else {
int i;
for (i = old_ignored_nr + 1; i<dir->ignored_nr; ++i)
for (int i = old_ignored_nr; i < dir->ignored_nr; i++)
FREE_AND_NULL(dir->ignored[i]);
dir->ignored_nr = old_ignored_nr;
}
@ -2149,8 +2148,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir,
*/
if ((dir->flags & DIR_SHOW_IGNORED_TOO) &&
!(dir->flags & DIR_KEEP_UNTRACKED_CONTENTS)) {
int i;
for (i = old_untracked_nr + 1; i<dir->nr; ++i)
for (int i = old_untracked_nr; i < dir->nr; i++)
FREE_AND_NULL(dir->entries[i]);
dir->nr = old_untracked_nr;
}