From 90813bb84c983914eab89a1cda1d72604fb8d25a Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Fri, 18 May 2012 15:29:03 -0700 Subject: [PATCH] crypt32: Fail earlier if CryptExportPublicKeyInfo fails. (cherry picked from commit da53cfc8bb15813fc6870d82aac059d50b95ccac) --- dlls/crypt32/cert.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index be7d07cd9fa..2d6697cc4a3 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -3202,8 +3202,10 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN } } - CryptExportPublicKeyInfo(hProv, dwKeySpec, X509_ASN_ENCODING, NULL, + ret = CryptExportPublicKeyInfo(hProv, dwKeySpec, X509_ASN_ENCODING, NULL, &pubKeySize); + if (!ret) + goto end; pubKey = CryptMemAlloc(pubKeySize); if (pubKey) { @@ -3237,6 +3239,7 @@ PCCERT_CONTEXT WINAPI CertCreateSelfSignCertificate(HCRYPTPROV_OR_NCRYPT_KEY_HAN } CryptMemFree(pubKey); } +end: if (releaseContext) CryptReleaseContext(hProv, 0); return context; -- 2.11.4.GIT