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

Re: [PATCH] format-patch: unleak "-v <num>"

From
Jeff King <peff@peff.net>
Date
Jan 16, 2023, 19:51 UTC
Message-ID
<Y8WqruNU5Z6ewJte@coredump.intra.peff.net>
In-Reply-To
<xmqqpmbecoom.fsf@gitster.g>
On Mon, Jan 16, 2023 at 10:35:53AM -0800, Junio C Hamano wrote:
Show 10 quoted lines
> > The word "unleak" in the subject made me think about UNLEAK(), so this
> > is a small tangent. This is exactly the kind of case that I designed
> > UNLEAK() for, because the solution really is "while you are assigning to
> > X, also keep a copy of the pointer in Y to be freed later".
> 
> Yup.  I was originally planning to use UNLEAK(), but it felt ugly to
> UNLEAK(rev.subject_prefix), as it stores borrowed pointer sometimes
> and owned pointer some other times, which is the exact reason why I
> started looking for a clean way to plug this leak.  So I ended up
> with declaring that the member should only store a borrowed pointer.

That's actually one of the nice things about UNLEAK(). It is OK to over-mark something that may or may not be allocated.

> The first sentence needs to be rephrased, as it does not make much
> sense to have something usually be X and always be X at the same
> time (I'd just remove "always" from there).
Yep, agreed.
-Peff
Previous: Junio C Hamano
Message 4 of 4 in “format-patch: unleak "-v <num>"”
  1. format-patch: unleak "-v <num>"Junio C Hamano, Jan 15, 2023
  2. Jeff KingJan 16, 2023
  3. Junio C HamanoJan 16, 2023
  4. Jeff KingJan 16, 2023

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.