Subject: [PATCH 00/23] Memory leak fixes (pt.8)

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 30 Sep 2024 11:13:07 +0200

Hi,

this is the 8th series of memory leak fixes. As usual, it fixes memory
leaks all over the place. Once applied, we're down to 35 test suites
that do not pass with the memory leak sanitizer.

This series is built on top of 3857aae53f (Git 2.47-rc0, 2024-09-25)
with the following two topisc merged into it:

  - ps/leakfixes-part-7 at 12dfc2475c (diffcore-break: fix leaking
    filespecs when merging broken pairs, 2024-09-26).

  - jk/http-leakfixes at f4c768c639 (http-push: clean up local_refs at
    exit, 2024-09-24).

Both of these topics are part of `next`.

Thanks!

Patrick

Patrick Steinhardt (23):
  builtin/annotate: fix leaking args vector
  read-cache: fix leaking hash context in `do_write_index()`
  scalar: fix leaking repositories
  shell: fix leaking strings
  wt-status: fix leaking buffer with sparse directories
  submodule: fix leaking submodule entry list
  builtin/stash: fix leaking `pathspec_from_file`
  builtin/pack-redundant: fix various memory leaks
  builtin/clone: fix leaking repo state when cloning with bundle URIs
  t/helper: fix leaking repository in partial-clone helper
  builtin/revert: fix leaking `gpg_sign` and `strategy` config
  diff: improve lifecycle management of diff queues
  line-log: fix several memory leaks
  pseudo-merge: fix various memory leaks
  pseudo-merge: fix leaking strmap keys
  pack-bitmap-write: fix leaking OID array
  midx-write: fix leaking buffer
  revision: fix memory leaks when rewriting parents
  revision: fix leaking saved parents
  pack-write: fix return parameter of `write_rev_file_order()`
  t/helper: fix leaks in proc-receive helper
  remote: fix leaking push reports
  builtin/send-pack: fix leaking list of push options

 bloom.c                                    |  8 +--
 branch.c                                   |  8 ++-
 builtin/annotate.c                         | 20 +++++--
 builtin/clone.c                            | 27 +++++++++
 builtin/index-pack.c                       |  7 +--
 builtin/pack-redundant.c                   | 40 +++++++++++--
 builtin/receive-pack.c                     |  5 +-
 builtin/revert.c                           | 17 ++++--
 builtin/send-pack.c                        |  1 +
 builtin/stash.c                            |  4 +-
 diff.c                                     | 22 +++----
 diffcore-break.c                           |  8 +--
 diffcore-pickaxe.c                         |  4 +-
 diffcore-rename.c                          |  3 +-
 diffcore-rotate.c                          |  3 +-
 diffcore.h                                 | 10 ++--
 line-log.c                                 | 69 +++++++++++++---------
 log-tree.c                                 |  4 +-
 merge-ort.c                                |  2 +-
 midx-write.c                               |  5 +-
 pack-bitmap-write.c                        |  9 +++
 pack-bitmap.c                              |  4 +-
 pack-write.c                               | 42 +++++++------
 pack.h                                     |  4 +-
 pseudo-merge.c                             | 23 +++++++-
 pseudo-merge.h                             |  2 +
 read-cache.c                               |  1 +
 remote.c                                   | 15 +++++
 remote.h                                   |  4 +-
 revision.c                                 | 14 ++++-
 scalar.c                                   |  1 +
 shell.c                                    |  6 +-
 submodule-config.c                         | 15 ++++-
 submodule-config.h                         |  3 +
 t/helper/test-partial-clone.c              |  2 +
 t/helper/test-proc-receive.c               |  7 +++
 t/t0410-partial-clone.sh                   |  1 +
 t/t1092-sparse-checkout-compatibility.sh   |  1 +
 t/t3207-branch-submodule.sh                |  1 +
 t/t3427-rebase-subtree.sh                  |  1 +
 t/t3514-cherry-pick-revert-gpg.sh          |  1 +
 t/t3909-stash-pathspec-file.sh             |  1 +
 t/t5323-pack-redundant.sh                  |  1 +
 t/t5327-multi-pack-bitmaps-rev.sh          |  1 +
 t/t5333-pseudo-merge-bitmaps.sh            |  1 +
 t/t5334-incremental-multi-pack-index.sh    |  2 +
 t/t5411-proc-receive-hook.sh               |  1 +
 t/t5545-push-options.sh                    |  1 +
 t/t5730-protocol-v2-bundle-uri-file.sh     |  1 +
 t/t5731-protocol-v2-bundle-uri-git.sh      |  1 +
 t/t5732-protocol-v2-bundle-uri-http.sh     |  1 +
 t/t6012-rev-list-simplify.sh               |  1 +
 t/t6016-rev-list-graph-simplify-history.sh |  1 +
 t/t7003-filter-branch.sh                   |  1 +
 t/t8001-annotate.sh                        |  1 +
 t/t9210-scalar.sh                          |  1 +
 t/t9211-scalar-clone.sh                    |  1 +
 t/t9350-fast-export.sh                     |  1 +
 t/t9400-git-cvsserver-server.sh            |  1 +
 t/t9402-git-cvsserver-refs.sh              |  1 +
 t/t9850-shell.sh                           |  2 +
 wt-status.c                                |  6 +-
 62 files changed, 329 insertions(+), 123 deletions(-)

-- 
2.46.2.852.g229c0bf0e5.dirty