git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 00/12] Fix all leaks in tests t0002-t0099: Part 1

From
Andrzej Hunt via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 9, 2021, 18:47 UTC
Message-ID
<pull.929.git.1617994052.gitgitgadget@gmail.com>

This series fixes approximately half of the real leaks I've found while running t0002 - t0099 under LSAN.

2 more series will likely be needed to allow t0000-t0099 to pass with LSAN enabled. (I have all the necessary fixes ready and tested on my machine, although I want to revisit some of my changes before I'm happy enough to send them out for review - either way I figure it's easiest to deal with one batch at a time, so I'll hold off on sending those out for now. One series is going to consist almost entirely of UNLEAK annotations that are boring and not worth merging until the real leaks are fixed.)

The exciting news is that once we succeed in getting t000-t0099 to run leak free, we'll be a significant step closer to being able to run the entire test-suite leak-free:

 * before the merging of ah/plugleaks (fixing leaks in t0001): 53% of test
   cases fail when LSAN is enabled (12386/23330).
 * with ah/plugleaks + this series + my 2 currently unpublished series: 34%
   of test cases fail when LSAN is enabled (7829/23342).

(I haven't bothered to test most of the intermediate stages, but ISTR that ah/plugleaks which only had a marginal effect - somewhere on the order of 51-52% test cases were failing after that work merged.)

On the topic of avoiding regressions: I've started running a subset of the test-suite with LSAN enabled (in addition to the full test-suite with ASAN and UBSAN) on my Github fork of git, automatically on a daily basis. This should hopefully help catch any new leaks that appear (and also new ASAN/UBSAN issues). [The entire test-suite takes around 35 minutes with ASAN or UBSAN enabled, which isn't too bad compared to the default linux-gcc/linux-clang jobs which take a similar amount of time - although they run the test-suite twice with 2 configurations.]

Andrzej Hunt (12):
  revision: free remainder of old commit list in limit_list
  wt-status: fix multiple small leaks
  ls-files: free max_prefix when done
  bloom: clear each bloom_key after use
  branch: FREE_AND_NULL instead of NULL'ing real_ref
  builtin/bugreport: don't leak prefixed filename
  builtin/check-ignore: clear_pathspec before returning
  builtin/checkout: clear pending objects after diffing
  mailinfo: also free strbuf lists when clearing mailinfo
  builtin/for-each-ref: free filter and UNLEAK sorting.
  builtin/rebase: release git_format_patch_opt too
  builtin/rm: avoid leaking pathspec and seen
 bloom.c                |  1 +
 branch.c               |  2 +-
 builtin/bugreport.c    |  8 +++++---
 builtin/check-ignore.c |  1 +
 builtin/checkout.c     |  1 +
 builtin/for-each-ref.c |  3 +++
 builtin/ls-files.c     |  1 +
 builtin/rebase.c       |  1 +
 builtin/rm.c           |  2 ++
 mailinfo.c             | 14 +++-----------
 revision.c             |  1 +
 wt-status.c            |  4 ++++
 12 files changed, 24 insertions(+), 15 deletions(-)
base-commit: 89b43f80a514aee58b662ad606e6352e03eaeee4
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-929%2Fahunt%2Fleaksan-100-part1-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-929/ahunt/leaksan-100-part1-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/929
-- 
gitgitgadget
Next: Andrzej Hunt via GitGitGadget
Message 1 of 35 in “Fix all leaks in tests t0002-t0099: Part 1”
  1. 00/12 Fix all leaks in tests t0002-t0099: Part 1Andrzej Hunt via GitGitGadget, Apr 9, 2021
  2. 01/12 revision: free remainder of old commit list in limit_listAndrzej Hunt via GitGitGadget, Apr 9, 2021
  3. René ScharfeApr 10, 2021
  4. Andrzej HuntApr 25, 2021
  5. 03/12 ls-files: free max_prefix when doneAndrzej Hunt via GitGitGadget, Apr 9, 2021
  6. René ScharfeApr 10, 2021
  7. Andrzej HuntApr 25, 2021
  8. 02/12 wt-status: fix multiple small leaksAndrzej Hunt via GitGitGadget, Apr 9, 2021
  9. 05/12 branch: FREE_AND_NULL instead of NULL'ing real_refAndrzej Hunt via GitGitGadget, Apr 9, 2021
  10. 04/12 bloom: clear each bloom_key after useAndrzej Hunt via GitGitGadget, Apr 9, 2021
  11. SZEDER GáborApr 11, 2021
  12. Andrzej HuntApr 25, 2021
  13. 06/12 builtin/bugreport: don't leak prefixed filenameAndrzej Hunt via GitGitGadget, Apr 9, 2021
  14. 07/12 builtin/check-ignore: clear_pathspec before returningAndrzej Hunt via GitGitGadget, Apr 9, 2021
  15. 08/12 builtin/checkout: clear pending objects after diffingAndrzej Hunt via GitGitGadget, Apr 9, 2021
  16. 09/12 mailinfo: also free strbuf lists when clearing mailinfoAndrzej Hunt via GitGitGadget, Apr 9, 2021
  17. Junio C HamanoApr 11, 2021
  18. Andrzej HuntApr 25, 2021
  19. 10/12 builtin/for-each-ref: free filter and UNLEAK sorting.Andrzej Hunt via GitGitGadget, Apr 9, 2021
  20. 11/12 builtin/rebase: release git_format_patch_opt tooAndrzej Hunt via GitGitGadget, Apr 9, 2021
  21. 12/12 builtin/rm: avoid leaking pathspec and seenAndrzej Hunt via GitGitGadget, Apr 9, 2021
  22. 00/12 Fix all leaks in tests t0002-t0099: Part 1Andrzej Hunt via GitGitGadget, Apr 25, 2021
  23. 01/12 revision: free remainder of old commit list in limit_listAndrzej Hunt via GitGitGadget, Apr 25, 2021
  24. 02/12 wt-status: fix multiple small leaksAndrzej Hunt via GitGitGadget, Apr 25, 2021
  25. 03/12 ls-files: free max_prefix when doneAndrzej Hunt via GitGitGadget, Apr 25, 2021
  26. 05/12 branch: FREE_AND_NULL instead of NULL'ing real_refAndrzej Hunt via GitGitGadget, Apr 25, 2021
  27. 04/12 bloom: clear each bloom_key after useAndrzej Hunt via GitGitGadget, Apr 25, 2021
  28. 06/12 builtin/bugreport: don't leak prefixed filenameAndrzej Hunt via GitGitGadget, Apr 25, 2021
  29. 07/12 builtin/check-ignore: clear_pathspec before returningAndrzej Hunt via GitGitGadget, Apr 25, 2021
  30. 09/12 mailinfo: also free strbuf lists when clearing mailinfoAndrzej Hunt via GitGitGadget, Apr 25, 2021
  31. Junio C HamanoApr 28, 2021
  32. 10/12 builtin/for-each-ref: free filter and UNLEAK sorting.Andrzej Hunt via GitGitGadget, Apr 25, 2021
  33. 08/12 builtin/checkout: clear pending objects after diffingAndrzej Hunt via GitGitGadget, Apr 25, 2021
  34. 11/12 builtin/rebase: release git_format_patch_opt tooAndrzej Hunt via GitGitGadget, Apr 25, 2021
  35. 12/12 builtin/rm: avoid leaking pathspec and seenAndrzej Hunt via GitGitGadget, Apr 25, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.