Commit be0d2944 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Fix memory leak in failure cases.

parent 546bfa2c
...@@ -160,7 +160,7 @@ PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, ...@@ -160,7 +160,7 @@ PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType,
data = CryptMemAlloc(cbCertEncoded); data = CryptMemAlloc(cbCertEncoded);
if (!data) if (!data)
{ {
CryptMemFree(cert); CertFreeCertificateContext(cert);
cert = NULL; cert = NULL;
goto end; goto end;
} }
......
...@@ -58,7 +58,7 @@ PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD dwCertEncodingType, ...@@ -58,7 +58,7 @@ PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD dwCertEncodingType,
data = CryptMemAlloc(cbCrlEncoded); data = CryptMemAlloc(cbCrlEncoded);
if (!data) if (!data)
{ {
CryptMemFree(crl); CertFreeCRLContext(crl);
crl = NULL; crl = NULL;
goto end; goto end;
} }
......
...@@ -447,7 +447,7 @@ PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, ...@@ -447,7 +447,7 @@ PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType,
end: end:
if (!ret) if (!ret)
{ {
CryptMemFree(ctl); CertFreeCTLContext(ctl);
ctl = NULL; ctl = NULL;
LocalFree(ctlInfo); LocalFree(ctlInfo);
CryptMemFree(content); CryptMemFree(content);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment