From: Jeff King <peff@peff.net>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH 0/2] Rust hash cleanups
Date: Sun, 19 Jul 2026 04:07:54 -0400 [thread overview]
Message-ID: <20260719080754.GA429688@coredump.intra.peff.net> (raw)
In-Reply-To: <20260719010842.17991-1-sandals@crustytoothpaste.net>
On Sun, Jul 19, 2026 at 01:08:40AM +0000, brian m. carlson wrote:
> Peff recently sent out a series to fix several memory leaks with our
> hashing code when not using the default block algorithm. This series
> follows up with a few fixes to our Rust hash code, which calls the C
> code, to fix various memory problems.
Both of these look good to me (modulo my almost-zero knowledge of the
Rust bits).
I was worried at first that I had introduced new problems with my fixes,
but I think these are both pre-existing issues (really just variants of
the cleanups I did in the C code).
For patch 1, an alternative is to switch git_hash_clone() to _not_
require initialization. But it introduces the leak problem in the
opposite direction. E.g., hashfile_truncate() wants to overwrite
existing state, so it would now need to discard() before cloning. I
doubt it's worth the effort or risk of regression to save the tiny bit
of effort spent on a few init-then-overwrite cases.
So the approach taken here makes sense (and obviously this is just
following the C code's lead anyway).
-Peff
prev parent reply other threads:[~2026-07-19 8:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-19 1:08 [PATCH 0/2] Rust hash cleanups brian m. carlson
2026-07-19 1:08 ` [PATCH 1/2] hash: initialize context before cloning brian m. carlson
2026-07-19 1:08 ` [PATCH 2/2] rust: discard hash context when finished brian m. carlson
2026-07-19 8:07 ` 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=20260719080754.GA429688@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
/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