tpm2: Helpers: Fix a possible memory leak

Fix a possible memory leak that may occur in case of a failure in
ObjectGetPublicParameters. The already allocated dP, dQ, and qInv
need to be freed.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2025-06-13 13:43:07 -04:00 committed by Stefan Berger
parent daa2dbdc4d
commit 22bb8db8e6

View File

@ -867,7 +867,7 @@ InitOpenSSLRSAPrivateKey(OBJECT *rsaKey, // IN
TPM_RC retVal;
if (ObjectGetPublicParameters(rsaKey, &N, &E) != 1)
return TPM_RC_FAILURE;
ERROR_EXIT(TPM_RC_FAILURE);
if(!rsaKey->attributes.privateExp)
CryptRsaLoadPrivateExponent(&rsaKey->publicArea, &rsaKey->sensitive,