sha256/gcrypt: fix memory leak with SHA-256 repos
commit8b608f3fb84388bb1b6da70feb62e20a19390cb6
authorEric Wong <e@80x24.org>
Mon, 31 Jul 2023 12:08:07 +0000 (31 12:08 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 31 Jul 2023 15:57:15 +0000 (31 08:57 -0700)
tree3457574a965687827c816b1f8429d4f23d698b56
parentb4b85e41a74eaf61dfb490004541622e63df092b
sha256/gcrypt: fix memory leak with SHA-256 repos

`gcry_md_open' needs to be paired with `gcry_md_close' to ensure
resources are released.  Since our internal APIs don't have
separate close/release callbacks, sticking it into the finalization
callback seems appropriate.

Building with SANITIZE=leak and running `git fsck' on a SHA-256
repository no longer reports leaks.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha256/gcrypt.h