Re: [PATCH 0/2] Rust hash cleanups
Jeff King <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
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