diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 982ba2b13..782d3199a 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -344,8 +344,11 @@ int EVP_Digest(const void *data, size_t count, void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) { - EVP_MD_CTX_cleanup(ctx); - OPENSSL_free(ctx); + if (ctx) + { + EVP_MD_CTX_cleanup(ctx); + OPENSSL_free(ctx); + } } /* This call frees resources associated with the context */