Jacek Caban : crypt32: Always return TRUE from CertFreeCertificateContext.

Alexandre Julliard julliard at winehq.org
Fri Oct 18 14:24:16 CDT 2013


Module: wine
Branch: master
Commit: f329de4df44d028d544e6d758a9f4a49066ccbb1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f329de4df44d028d544e6d758a9f4a49066ccbb1

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Oct 18 10:50:03 2013 +0200

crypt32: Always return TRUE from CertFreeCertificateContext.

---

 dlls/crypt32/cert.c       |    6 ++----
 dlls/crypt32/tests/cert.c |    9 +++++++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 2b60041..2a68544 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -370,13 +370,11 @@ PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(PCCERT_CONTEXT pCertContex
 
 BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
 {
-    BOOL ret = TRUE;
-
     TRACE("(%p)\n", pCertContext);
 
     if (pCertContext)
-        ret = Context_Release(&cert_from_ptr(pCertContext)->base);
-    return ret;
+        Context_Release(&cert_from_ptr(pCertContext)->base);
+    return TRUE;
 }
 
 DWORD WINAPI CertEnumCertificateContextProperties(PCCERT_CONTEXT pCertContext,
diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c
index a96a75f..a117332 100644
--- a/dlls/crypt32/tests/cert.c
+++ b/dlls/crypt32/tests/cert.c
@@ -725,7 +725,8 @@ static void testDupCert(void)
     dupContext = CertDuplicateCertificateContext(context);
     ok(dupContext == context, "context != dupContext\n");
 
-    CertFreeCertificateContext(dupContext);
+    ret = CertFreeCertificateContext(dupContext);
+    ok(ret, "CertFreeCertificateContext failed\n");
 
     store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL);
     ok(store != NULL, "CertOpenStore failed: %d\n", GetLastError());
@@ -760,7 +761,8 @@ static void testDupCert(void)
     ok(context2->hCertStore == context->hCertStore, "Unexpected hCertStore\n");
 
     CertFreeCertificateContext(context2);
-    CertFreeCertificateContext(context);
+    ret = CertFreeCertificateContext(context);
+    ok(ret, "CertFreeCertificateContext failed\n");
 
     CertCloseStore(store, 0);
     CertCloseStore(store2, 0);
@@ -768,6 +770,9 @@ static void testDupCert(void)
     SetLastError(0xdeadbeef);
     context = CertDuplicateCertificateContext(NULL);
     ok(context == NULL, "Expected context to be NULL\n");
+
+    ret = CertFreeCertificateContext(NULL);
+    ok(ret, "CertFreeCertificateContext failed\n");
 }
 
 static void testLinkCert(void)




More information about the wine-cvs mailing list