summaryrefslogtreecommitdiff
path: root/drivers/builtin_openssl2/crypto/evp/digest.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/builtin_openssl2/crypto/evp/digest.c')
-rw-r--r--drivers/builtin_openssl2/crypto/evp/digest.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/builtin_openssl2/crypto/evp/digest.c b/drivers/builtin_openssl2/crypto/evp/digest.c
index f2643f3248..5b642b23fc 100644
--- a/drivers/builtin_openssl2/crypto/evp/digest.c
+++ b/drivers/builtin_openssl2/crypto/evp/digest.c
@@ -212,8 +212,10 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
}
#endif
if (ctx->digest != type) {
- if (ctx->digest && ctx->digest->ctx_size)
+ if (ctx->digest && ctx->digest->ctx_size) {
OPENSSL_free(ctx->md_data);
+ ctx->md_data = NULL;
+ }
ctx->digest = type;
if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) {
ctx->update = type->update;