mbox series

[00/11] submodule--helper: fix memory leaks

Message ID cover-00.11-00000000000-20220713T131601Z-avarab@gmail.com (mailing list archive)
Headers show
Series submodule--helper: fix memory leaks | expand

Message

Ævar Arnfjörð Bjarmason July 13, 2022, 1:16 p.m. UTC
This series fixes most of the memory leaks in
builtin/submodule--helper.c, it needs to go on top of
gc/submodule-use-super-prefix (which in turn goes on top of my
ab/submodule-cleanup.

I'm planning to submit the patches to "git rm git-submodule.sh" after
this series, but fixing these leaks gives us a much better foundation
for doing so.

I.e. we'll eventually want to have this code invoke itself without
needing run_command(), and being able to have clear lifecycle
management of the data it uses makes it possible to eventually call
the relevant code as a utility function instead.

Ævar Arnfjörð Bjarmason (11):
  submodule.c: free() memory from xgetcwd()
  submodule--helper: replace memset() with { 0 }-initialization
  submodule--helper: fix "module_clone_data" memory leaks
  submodule--helper: fix "struct pathspec" memory leaks
  submodule--helper: free() leaking {run,capture}_command() argument
  submodule--helper: add and use *_release() functions
  submodule--helper: fix "errmsg_str" memory leak
  submodule--helper: fix "sm_path" and other "module_cb_list" leaks
  submodule--helper: free "char *" in "struct update_data"
  submodule--helper: fix a leak with repo_clear()
  submodule--helper:fix "reference" leak is "module_clone_data"

Ævar Arnfjörð Bjarmason (11):
  submodule.c: free() memory from xgetcwd()
  submodule--helper: replace memset() with { 0 }-initialization
  submodule--helper: fix "module_clone_data" memory leaks
  submodule--helper: fix "struct pathspec" memory leaks
  submodule--helper: free() leaking {run,capture}_command() argument
  submodule--helper: add and use *_release() functions
  submodule--helper: fix "errmsg_str" memory leak
  submodule--helper: fix "sm_path" and other "module_cb_list" leaks
  submodule--helper: free "char *" in "struct update_data"
  submodule--helper: fix a leak with repo_clear()
  submodule--helper: fix "reference" leak is "module_clone_data"

 builtin/submodule--helper.c        | 260 ++++++++++++++++++++++-------
 submodule.c                        |   3 +-
 t/t2403-worktree-move.sh           |   1 +
 t/t6008-rev-list-submodule.sh      |   1 +
 t/t6134-pathspec-in-submodule.sh   |   1 +
 t/t7412-submodule-absorbgitdirs.sh |   1 +
 t/t7414-submodule-mistakes.sh      |   2 +
 t/t7506-status-submodule.sh        |   1 +
 t/t7507-commit-verbose.sh          |   2 +
 9 files changed, 207 insertions(+), 65 deletions(-)