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

Re: [PATCH 1/2] commit-graph: clean up leaked memory during write

From
Jeff King <peff@peff.net>
Date
Oct 2, 2018, 22:37 UTC
Message-ID
<20181002223738.GB5588@sigill.intra.peff.net>
In-Reply-To
<CAGZ79kYtNnNPMv0=rB4ie=tOoYEPPZ=CmYFg4PG2_j96vjODeQ@mail.gmail.com>
On Tue, Oct 02, 2018 at 10:59:28AM -0700, Stefan Beller wrote:
Show 9 quoted lines
> > Generally speaking, it
> > seems impossible to UNLEAK when dying, since we don't know what we have
> > allocated higher up in the call-stack.
> 
> I do not understand; I thought UNLEAK was specifically for the purpose of
> die() calls without imposing extra overhead; rereading 0e5bba53af
> (add UNLEAK annotation for reducing leak false positives, 2017-09-08)
> doesn't provide an example for prematurely die()ing, only for regular
> program exit.

I responded elsewhere, but as the author of UNLEAK, let me comment here: it was intended only for program exit. That's why there are no such examples. :)

If you're using it anywhere except the return from a cmd_* function, or a static-local helper that's called from a cmd_*, you should probably actually be freeing the memory.

-Peff
Previous: Martin ÅgrenNext: Derrick Stolee via GitGitGadget
Message 15 of 20 in “Clean up leaks in commit-graph.c”
  1. 0/2 Clean up leaks in commit-graph.cDerrick Stolee via GitGitGadget, Oct 2, 2018
  2. 1/2 commit-graph: clean up leaked memory during writeDerrick Stolee via GitGitGadget, Oct 2, 2018
  3. Martin ÅgrenOct 2, 2018
  4. Stefan BellerOct 2, 2018
  5. Martin ÅgrenOct 2, 2018
  6. Stefan BellerOct 2, 2018
  7. Jeff KingOct 2, 2018
  8. Stefan BellerOct 2, 2018
  9. Derrick StoleeOct 3, 2018
  10. 0/2 commit-graph: more leak fixesMartin Ågren, Oct 3, 2018
  11. 1/2 commit-graph: free `struct packed_git` after closing itMartin Ågren, Oct 3, 2018
  12. 2/2 builtin/commit-graph.c: UNLEAK variablesMartin Ågren, Oct 3, 2018
  13. Derrick StoleeOct 3, 2018
  14. Martin ÅgrenOct 3, 2018
  15. Jeff KingOct 2, 2018
  16. 2/2 commit-graph: reduce initial oid allocationDerrick Stolee via GitGitGadget, Oct 2, 2018
  17. 0/3 Clean up leaks in commit-graph.cDerrick Stolee via GitGitGadget, Oct 3, 2018
  18. 1/3 commit-graph: clean up leaked memory during writeDerrick Stolee via GitGitGadget, Oct 3, 2018
  19. 2/3 builtin/commit-graph.c: UNLEAK variablesMartin Ågren via GitGitGadget, Oct 3, 2018
  20. 3/3 commit-graph: reduce initial oid allocationDerrick Stolee via GitGitGadget, Oct 3, 2018

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.