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

@ -364,9 +364,13 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
if (!info->quiet)
printf(_("Entering '%s'\n"), displaypath);
if (info->argv[0] && run_command(&cp))
die(_("run_command returned non-zero status for %s\n."),
displaypath);
if (info->argv[0]) {
if (run_command(&cp))
die(_("run_command returned non-zero status for %s\n."),
displaypath);
} else {
child_process_clear(&cp);
}
if (info->recursive) {
struct child_process cpr = CHILD_PROCESS_INIT;
@ -1622,6 +1626,8 @@ static int add_possible_reference_from_superproject(
; /* nothing */
}
}
strbuf_release(&err);
strbuf_release(&sb);
}
@ -2026,6 +2032,7 @@ struct update_data {
static void update_data_release(struct update_data *ud)
{
free(ud->displaypath);
submodule_update_strategy_release(&ud->update_strategy);
module_list_release(&ud->list);
}
@ -2646,15 +2653,20 @@ static int update_submodule(struct update_data *update_data)
if (!update_data->nofetch) {
if (fetch_in_submodule(update_data->sm_path, update_data->depth,
0, NULL))
0, NULL)) {
free(remote_ref);
return die_message(_("Unable to fetch in submodule path '%s'"),
update_data->sm_path);
}
}
if (repo_resolve_gitlink_ref(the_repository, update_data->sm_path,
remote_ref, &update_data->oid))
return die_message(_("Unable to find %s revision in submodule path '%s'"),
remote_ref, update_data->sm_path);
remote_ref, &update_data->oid)) {
ret = die_message(_("Unable to find %s revision in submodule path '%s'"),
remote_ref, update_data->sm_path);
free(remote_ref);
return ret;
}
free(remote_ref);
}