mirror of
https://github.com/git/git
synced 2024-11-04 16:17:49 +00:00
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>
This commit is contained in:
parent
8b608f3fb8
commit
823839bda1
1 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue