From: Wenkai Lin <linwenkai6@hisilicon.com> Zero out the session and data pointers in uadk_digest_cleanup after freeing them to prevent double-free on repeated cleanup calls. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> --- src/uadk_prov_digest.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/uadk_prov_digest.c b/src/uadk_prov_digest.c index 3894920..7488fc6 100644 --- a/src/uadk_prov_digest.c +++ b/src/uadk_prov_digest.c @@ -775,11 +775,15 @@ static int uadk_digest_digest(struct digest_priv_ctx *priv, const void *data, static void uadk_digest_cleanup(struct digest_priv_ctx *priv) { - if (priv->sess) + if (priv->sess) { wd_digest_free_sess(priv->sess); + priv->sess = 0; + } - if (priv->data) + if (priv->data) { OPENSSL_clear_free(priv->data, DIGEST_BLOCK_SIZE); + priv->data = NULL; + } digest_soft_cleanup(priv); } -- 2.53.0.windows.2