diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 2b60041e992..2a685448ed7 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 a96a75ff82c..a1173329412 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)