[PATCH 1/3] crypt32: Correctly free memory in CNG_ImportRSAPubKey().

Hans Leidekker hans at codeweavers.com
Wed Mar 30 04:47:44 CDT 2022


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/crypt32/cert.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 33811dfadc1..b7789fd6fcd 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -2720,7 +2720,7 @@ static BOOL CNG_ImportRSAPubKey(CERT_PUBLIC_KEY_INFO *info, BCRYPT_KEY_HANDLE *k
     else
     {
         FIXME("Unsupported RSA algorithm: %#x\n", hdr->aiKeyAlg);
-        CryptMemFree(hdr);
+        LocalFree(hdr);
         SetLastError(NTE_BAD_ALGID);
         return FALSE;
     }
@@ -2762,7 +2762,7 @@ static BOOL CNG_ImportRSAPubKey(CERT_PUBLIC_KEY_INFO *info, BCRYPT_KEY_HANDLE *k
     CryptMemFree(rsakey);
 
 done:
-    CryptMemFree(hdr);
+    LocalFree(hdr);
     if (alg) BCryptCloseAlgorithmProvider(alg, 0);
     if (status) SetLastError(RtlNtStatusToDosError(status));
     return !status;
@@ -2773,7 +2773,6 @@ BOOL CNG_ImportPubKey(CERT_PUBLIC_KEY_INFO *pubKeyInfo, BCRYPT_KEY_HANDLE *key)
     if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_ECC_PUBLIC_KEY))
         return CNG_ImportECCPubKey(pubKeyInfo, key);
 
-
     if (!strcmp(pubKeyInfo->Algorithm.pszObjId, szOID_RSA_RSA))
         return CNG_ImportRSAPubKey(pubKeyInfo, key);
 
-- 
2.30.2




More information about the wine-devel mailing list