diff options
Diffstat (limited to 'src/lib/libcrypto/evp/digest.c')
-rw-r--r-- | src/lib/libcrypto/evp/digest.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index 467e6b5ae9..d14e8e48d5 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c | |||
@@ -267,6 +267,7 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) | |||
267 | return FIPS_digestfinal(ctx, md, size); | 267 | return FIPS_digestfinal(ctx, md, size); |
268 | #else | 268 | #else |
269 | int ret; | 269 | int ret; |
270 | |||
270 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); | 271 | OPENSSL_assert(ctx->digest->md_size <= EVP_MAX_MD_SIZE); |
271 | ret=ctx->digest->final(ctx,md); | 272 | ret=ctx->digest->final(ctx,md); |
272 | if (size != NULL) | 273 | if (size != NULL) |
@@ -365,8 +366,11 @@ int EVP_Digest(const void *data, size_t count, | |||
365 | 366 | ||
366 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) | 367 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) |
367 | { | 368 | { |
368 | EVP_MD_CTX_cleanup(ctx); | 369 | if (ctx) |
369 | OPENSSL_free(ctx); | 370 | { |
371 | EVP_MD_CTX_cleanup(ctx); | ||
372 | OPENSSL_free(ctx); | ||
373 | } | ||
370 | } | 374 | } |
371 | 375 | ||
372 | /* This call frees resources associated with the context */ | 376 | /* This call frees resources associated with the context */ |