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

Re: [PATCH 1/2] stop calling UNLEAK() before die()

From
Jeff King <peff@peff.net>
Date
Aug 14, 2020, 10:17 UTC
Message-ID
<20200814101706.GC3312240@coredump.intra.peff.net>
In-Reply-To
<275f3f6c-77ed-fddd-8f79-28f25b257362@gmail.com>
On Thu, Aug 13, 2020 at 02:08:45PM -0400, Derrick Stolee wrote:
Show 11 quoted lines
> On 8/13/2020 11:55 AM, Jeff King wrote:
> > The point of UNLEAK() is to make a reference to a variable that is about
> > to go out of scope so that leak-checkers will consider it to be
> > not-leaked. Doing so right before die() is therefore pointless; even
> > though we are about to exit the program, the variable will still be on
> > the stack and accessible to leak-checkers.
> > 
> > These annotations aren't really hurting anything, but they clutter the
> > code and set a bad example of how to use UNLEAK().
> 
> Good justification. I'll stop being a bad example ;)

To be fair, it seems clear that UNLEAK() as a concept is rather confusing. I really never intended anybody to start sprinkling it around the code. It was meant to be a tool for folks who are interested in running leak-checkers to do in-code annotations (for "yes, I know this leaks but not until the program effectively ends").

I certainly don't mind if people writing new code preemptively annotate this kind of leak. But I also wouldn't really encourage authors to put a lot of effort into it, given the current state of the annotations.

-Peff
Previous: Derrick StoleeNext: Jeff King
Message 4 of 9 in “UNLEAK style fixes”
  1. 0/2 UNLEAK style fixesJeff King, Aug 13, 2020
  2. 1/2 stop calling UNLEAK() before die()Jeff King, Aug 13, 2020
  3. Derrick StoleeAug 13, 2020
  4. Jeff KingAug 14, 2020
  5. 2/2 ls-remote: simplify UNLEAK() usageJeff King, Aug 13, 2020
  6. Derrick StoleeAug 13, 2020
  7. Eric SunshineAug 13, 2020
  8. Jeff KingAug 14, 2020
  9. Eric SunshineAug 14, 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.