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

Re: [PATCH] reftable: fix unlikely leak on API error

From
Jeff King <peff@peff.net>
Date
Jun 28, 2026, 09:06 UTC
Message-ID
<20260628090619.GA699336@coredump.intra.peff.net>
In-Reply-To
<20260628090314.GA661068@coredump.intra.peff.net>
On Sun, Jun 28, 2026 at 05:03:14AM -0400, Jeff King wrote:
Show 5 quoted lines
> Noticed by Coverity as a "new" problem, though it has been there for
> over a year.  Presumably the nearby changes from 44f46f2be5 (reftable:
> split up write options, 2026-06-25) confused it. There's a backlog of
> hundreds of Coverity problems, most of which are garbage, so I tend to
> only look at the ones it marks as new.

This does conflict textually with 44f46f2be5, which adds a new line nearby. Resolving like:

diff --cc reftable/writer.c index f850e9d599,1bd4aa388b..d969a6a021

--- a/reftable/writer.c
+++ b/reftable/writer.c
@@@ -161,9 -158,10 +157,13 @@@ int reftable_writer_new(struct reftable
  	if (opts.block_size >= (1 << 24))
  		return REFTABLE_API_ERROR;
  
 +	if (!hash_id)
 +		hash_id = REFTABLE_HASH_SHA1;
 +
+ 	wp = reftable_calloc(1, sizeof(*wp));
+ 	if (!wp)
+ 		return REFTABLE_OUT_OF_MEMORY_ERROR;
+ 
  	reftable_buf_init(&wp->block_writer_data.last_key);
  	reftable_buf_init(&wp->last_key);
  	reftable_buf_init(&wp->scratch);

makes sense to me, as it keeps the hash_id setting with the "opts"
setup.

-Peff
Previous: Jeff KingNext: Patrick Steinhardt
Message 2 of 3 in “reftable: fix unlikely leak on API error”
  1. reftable: fix unlikely leak on API errorJeff King, Jun 28, 2026
  2. Jeff KingJun 28, 2026
  3. Patrick SteinhardtJun 29, 2026

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.