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

Re: [PATCH 0/6] more small leak fixes

From
Jeff King <peff@peff.net>
Date
Aug 14, 2020, 16:27 UTC
Message-ID
<20200814162749.GB595840@coredump.intra.peff.net>
In-Reply-To
<20200814162525.GA595840@coredump.intra.peff.net>
On Fri, Aug 14, 2020 at 12:25:25PM -0400, Jeff King wrote:
Show 17 quoted lines
> On Fri, Aug 14, 2020 at 12:13:28PM -0400, Jeff King wrote:
> 
> > Based on the discussion over in [1], I wondered how close we were to
> > being able to run some test scripts with a leak-checker like LSan not
> > complaining. The answer is...not close.
> > 
> > I picked t5526 more or less at random (it was the first failure when I
> > did a parallel "make test") to see what it would take to get it passing.
> > After much effort...I have t5526.1, the setup test, running clean. :)
> 
> For reference, here are the UNLEAK() calls I had to add to silence the
> false positives. Some of these are kind of sketchy. For example,
> declaring that wt_status_collect_changes_index() is allowed to leak is a
> bit low-level for my tastes (in general it's probably only called once
> per program, but it's getting quite far from the bottom of the stack).
> But there's actually no convenient way to free the various bits of a
> rev_info, so marking it with UNLEAK() is an expedient hack.

And by the way, having gone through this exercise, I'm re-convinced that UNLEAK() is reasonable to keep. A lot of these cases would have been very awkward with free(). Not insurmountable, but cases where a variable is sometimes-allocated and sometimes-not get rather tricky.

-Peff
Previous: Jeff KingNext: Jeff King
Message 12 of 20 in “more small leak fixes”
  1. 0/6 more small leak fixesJeff King, Aug 14, 2020
  2. 1/6 submodule--helper: use strbuf_release() to free strbufsJeff King, Aug 14, 2020
  3. 2/6 checkout: fix leak of non-existent branch namesJeff King, Aug 14, 2020
  4. 3/6 config: fix leaks from git_config_get_string_const()Jeff King, Aug 14, 2020
  5. 4/6 config: drop git_config_get_string_const()Jeff King, Aug 14, 2020
  6. Junio C HamanoAug 14, 2020
  7. Jeff KingAug 15, 2020
  8. Junio C HamanoAug 17, 2020
  9. 5/6 config: fix leak in git_config_get_expiry_in_days()Jeff King, Aug 14, 2020
  10. 6/6 submodule--helper: fix leak of core.worktree valueJeff King, Aug 14, 2020
  11. Jeff KingAug 14, 2020
  12. Jeff KingAug 14, 2020
  13. 0/7 leak fixesJeff King, Aug 17, 2020
  14. 1/7 clear_pattern_list(): clear embedded hashmapsJeff King, Aug 17, 2020
  15. 2/7 submodule--helper: use strbuf_release() to free strbufsJeff King, Aug 17, 2020
  16. 3/7 checkout: fix leak of non-existent branch namesJeff King, Aug 17, 2020
  17. 4/7 config: fix leaks from git_config_get_string_const()Jeff King, Aug 17, 2020
  18. 6/7 config: fix leak in git_config_get_expiry_in_days()Jeff King, Aug 17, 2020
  19. 7/7 submodule--helper: fix leak of core.worktree valueJeff King, Aug 17, 2020
  20. 5/7 config: drop git_config_get_string_const()Jeff King, Aug 17, 2020

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.