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

@@ -152,11 +152,19 @@ uint64_t tr2tls_absolute_elapsed(uint64_t us)
return us - tr2tls_us_start_process;
}
static void tr2tls_key_destructor(void *payload)
{
struct tr2tls_thread_ctx *ctx = payload;
free((char *)ctx->thread_name);
free(ctx->array_us_start);
free(ctx);
}
void tr2tls_init(void)
{
tr2tls_start_process_clock();
pthread_key_create(&tr2tls_key, NULL);
pthread_key_create(&tr2tls_key, tr2tls_key_destructor);
init_recursive_mutex(&tr2tls_mutex);
tr2tls_thread_main =