]> git.99rst.org Git - git.git/commit
csum-file: provide a function to release checkpoints
authorJeff King <redacted>
Thu, 2 Jul 2026 08:03:19 +0000 (04:03 -0400)
committerJunio C Hamano <redacted>
Thu, 2 Jul 2026 16:50:47 +0000 (09:50 -0700)
commit46ba44e1fd6b1a3d71d529f6713821efc26072c9
tree4992cbaaa46bc60f36376b6e2bb580008a164fa2
parent64337aecded9e91a766b585b86bcf5f0342e0b87
csum-file: provide a function to release checkpoints

A hashfile_checkpoint struct is basically just a copy of the hash_ctx
state at a given point in the file. As such, it contains its own
git_hash_ctx which may (depending on the underlying hash implementation)
need to be discarded when we're done with it.

Let's add a "release" function which cleans up the hash context it
holds. I chose "release" here and not "discard" because you'd use this
to clean up every checkpoint, whether you used it or not. As opposed to
git_hash_discard(), which is needed only if you didn't call
git_hash_final().

There are only two callers which use hashfile_checkpoints, and we can
add release calls to both. When built with "SANITIZE=leak
OPENSSL_SHA1_UNSAFE=1", this makes both t1050 and t9300 leak-free.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
builtin/fast-import.c
csum-file.c
csum-file.h
object-file.c
git clone https://git.99rst.org/PROJECT