Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sha256
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-07-31 15:08:08 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-31 18:57:24 +0300
commit823839bda1a72c54fe8ac025fb70dd3403c11f46 (patch)
tree98aecbd735fb6b5dfa41876467a6e4c3870b93e3 /sha256
parent8b608f3fb84388bb1b6da70feb62e20a19390cb6 (diff)
sha256/gcrypt: die on gcry_md_open failures
`gcry_md_open' allocates memory and must (like all allocation functions) be checked for failure. Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha256')
-rw-r--r--sha256/gcrypt.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sha256/gcrypt.h b/sha256/gcrypt.h
index 1d06a778af..17a90f1052 100644
--- a/sha256/gcrypt.h
+++ b/sha256/gcrypt.h
@@ -9,7 +9,9 @@ typedef gcry_md_hd_t gcrypt_SHA256_CTX;
static inline void gcrypt_SHA256_Init(gcrypt_SHA256_CTX *ctx)
{
- gcry_md_open(ctx, GCRY_MD_SHA256, 0);
+ gcry_error_t err = gcry_md_open(ctx, GCRY_MD_SHA256, 0);
+ if (err)
+ die("gcry_md_open: %s", gcry_strerror(err));
}
static inline void gcrypt_SHA256_Update(gcrypt_SHA256_CTX *ctx, const void *data, size_t len)