Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH] reftable: fix unlikely leak on API error
Date: Sun, 28 Jun 2026 05:06:19 -0400	[thread overview]
Message-ID: <20260628090619.GA699336@coredump.intra.peff.net> (raw)
In-Reply-To: <20260628090314.GA661068@coredump.intra.peff.net>

On Sun, Jun 28, 2026 at 05:03:14AM -0400, Jeff King wrote:

> 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

      reply	other threads:[~2026-06-28  9:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-28  9:03 [PATCH] reftable: fix unlikely leak on API error Jeff King
2026-06-28  9:06 ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260628090619.GA699336@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox