Fix to make sure a double free cannot occur (ZD 21093)

This commit is contained in:
David Garske
2026-03-19 16:53:43 -07:00
parent 5b9d0a13bf
commit 5fdf32dec6
+2
View File
@@ -18413,6 +18413,7 @@ void FreeSignatureCtx(SignatureCtx* sigCtx)
if (sigCtx->key.ecc->nb_ctx != NULL) {
XFREE(sigCtx->key.ecc->nb_ctx, sigCtx->heap,
DYNAMIC_TYPE_TMP_BUFFER);
sigCtx->key.ecc->nb_ctx = NULL;
}
#endif /* WC_ECC_NONBLOCK && WOLFSSL_ASYNC_CRYPT_SW &&
WC_ASYNC_ENABLE_ECC */
@@ -18488,6 +18489,7 @@ void FreeSignatureCtx(SignatureCtx* sigCtx)
#ifndef WOLFSSL_NO_MALLOC
sigCtx->key.ptr = NULL;
#endif
sigCtx->keyOID = 0; /* mark key as freed (guards re-entry without malloc) */
}
#endif /* !NO_ASN_CRYPT */