mbox series

[00/14] tree-wide: small fixes for memory leaks

Message ID cover-00.14-00000000000-20220302T170718Z-avarab@gmail.com (mailing list archive)
Headers show
Series tree-wide: small fixes for memory leaks | expand

Message

Ævar Arnfjörð Bjarmason March 2, 2022, 5:10 p.m. UTC
This is a collection of various otherwise unrelated tree-wide fixes
for memory leaks.

In fixing more targeted memory leaks in specific areas I've run into
small leaks here & there. Rather than submit e.g. a 2-series patch for
just small bundle leaks, the same for range-diff etc. I thought it
made sense to submit these together.

Ævar Arnfjörð Bjarmason (14):
  index-pack: fix memory leaks
  merge-base: free() allocated "struct commit **" list
  diff.c: free "buf" in diff_words_flush()
  urlmatch.c: add and use a *_release() function
  remote-curl.c: free memory in cmd_main()
  bundle: call strvec_clear() on allocated strvec
  transport: stop needlessly copying bundle header references
  submodule--helper: fix trivial leak in module_add()
  commit-graph: fix memory leak in misused string_list API
  commit-graph: stop fill_oids_from_packs() progress on error and free()
  lockfile API users: simplify and don't leak "path"
  range-diff: plug memory leak in common invocation
  range-diff: plug memory leak in read_patches()
  repository.c: free the "path cache" in repo_clear()

 apply.c                     |  7 ++++++-
 apply.h                     |  2 ++
 builtin/bundle.c            |  1 +
 builtin/commit-graph.c      |  6 +++---
 builtin/config.c            |  2 +-
 builtin/index-pack.c        |  5 +++++
 builtin/merge-base.c        |  5 ++++-
 builtin/sparse-checkout.c   |  3 +--
 builtin/submodule--helper.c |  5 ++++-
 commit-graph.c              | 18 +++++++++++-------
 commit-graph.h              |  2 +-
 credential.c                |  1 +
 diff.c                      |  1 +
 path.h                      | 14 --------------
 range-diff.c                | 30 +++++++++++++-----------------
 remote-curl.c               | 12 ++++++++----
 repository.c                | 16 ++++++++++++++++
 repository.h                | 14 +++++++++++++-
 transport.c                 | 27 ++++++++++++++++-----------
 urlmatch.c                  |  5 +++++
 urlmatch.h                  |  1 +
 21 files changed, 113 insertions(+), 64 deletions(-)

Comments

Derrick Stolee March 2, 2022, 8:58 p.m. UTC | #1
On 3/2/2022 12:10 PM, Ævar Arnfjörð Bjarmason wrote:
> This is a collection of various otherwise unrelated tree-wide fixes
> for memory leaks.
> 
> In fixing more targeted memory leaks in specific areas I've run into
> small leaks here & there. Rather than submit e.g. a 2-series patch for
> just small bundle leaks, the same for range-diff etc. I thought it
> made sense to submit these together.

I read these patches, and they were quite small, so it wasn't hard.
The most difficult thing was going into the code just to get more
context than the patches allowed.

Thank you for fixing all of those memory leaks I introduced in the
commit-graph code.

I had a few nitpick comments on the first commit message, but I
think what I pointed out in patch 7 might be a problem that needs
fixing before this merges.

Thanks,
-Stolee