From be0d294485b38e40f5f270c143d18d48c8c3dbe2 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 22 Sep 2011 05:23:21 -0700 Subject: [PATCH] crypt32: Fix memory leak in failure cases. --- dlls/crypt32/cert.c | 2 +- dlls/crypt32/crl.c | 2 +- dlls/crypt32/ctl.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 0117f279c6e..63107e18f28 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -160,7 +160,7 @@ PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, data = CryptMemAlloc(cbCertEncoded); if (!data) { - CryptMemFree(cert); + CertFreeCertificateContext(cert); cert = NULL; goto end; } diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c index cafe564ad60..5b5a455909a 100644 --- a/dlls/crypt32/crl.c +++ b/dlls/crypt32/crl.c @@ -58,7 +58,7 @@ PCCRL_CONTEXT WINAPI CertCreateCRLContext(DWORD dwCertEncodingType, data = CryptMemAlloc(cbCrlEncoded); if (!data) { - CryptMemFree(crl); + CertFreeCRLContext(crl); crl = NULL; goto end; } diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index 09ebf26b6d5..9a8f1765b5a 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -447,7 +447,7 @@ PCCTL_CONTEXT WINAPI CertCreateCTLContext(DWORD dwMsgAndCertEncodingType, end: if (!ret) { - CryptMemFree(ctl); + CertFreeCTLContext(ctl); ctl = NULL; LocalFree(ctlInfo); CryptMemFree(content);