From 92324ab38e1fc8423ae4a78456bca62e5c7b7c56 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Fri, 30 Oct 2009 15:18:53 -0700 Subject: [PATCH] crypt32: Propagate errors from CertFree*Context to CertDelete*FromStore. --- dlls/crypt32/ctl.c | 8 +++----- dlls/crypt32/store.c | 15 +++++---------- dlls/crypt32/tests/store.c | 1 + 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index e2511fa7cb6..44b517aeff3 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -309,10 +309,7 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext) if (!pCtlContext) ret = TRUE; else if (!pCtlContext->hCertStore) - { - ret = TRUE; - CertFreeCTLContext(pCtlContext); - } + ret = CertFreeCTLContext(pCtlContext); else { PWINECRYPT_CERTSTORE hcs = pCtlContext->hCertStore; @@ -321,7 +318,8 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext) ret = FALSE; else ret = hcs->ctls.deleteContext(hcs, (void *)pCtlContext); - CertFreeCTLContext(pCtlContext); + if (ret) + ret = CertFreeCTLContext(pCtlContext); } return ret; } diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 8acc6f68b12..a529ac6e89e 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -966,10 +966,7 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext) if (!pCertContext) ret = TRUE; else if (!pCertContext->hCertStore) - { - ret = TRUE; - CertFreeCertificateContext(pCertContext); - } + ret = CertFreeCertificateContext(pCertContext); else { PWINECRYPT_CERTSTORE hcs = pCertContext->hCertStore; @@ -979,7 +976,7 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext) else ret = hcs->certs.deleteContext(hcs, (void *)pCertContext); if (ret) - CertFreeCertificateContext(pCertContext); + ret = CertFreeCertificateContext(pCertContext); } return ret; } @@ -1105,10 +1102,7 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext) if (!pCrlContext) ret = TRUE; else if (!pCrlContext->hCertStore) - { - ret = TRUE; - CertFreeCRLContext(pCrlContext); - } + ret = CertFreeCRLContext(pCrlContext); else { PWINECRYPT_CERTSTORE hcs = pCrlContext->hCertStore; @@ -1117,7 +1111,8 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext) ret = FALSE; else ret = hcs->crls.deleteContext(hcs, (void *)pCrlContext); - CertFreeCRLContext(pCrlContext); + if (ret) + ret = CertFreeCRLContext(pCrlContext); } return ret; } diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index ae10fbcfed2..88f53ed1e65 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -237,6 +237,7 @@ static void testMemStore(void) GetLastError()); /* try deleting a copy */ ret = CertDeleteCertificateFromStore(copy); + todo_wine ok(ret, "CertDeleteCertificateFromStore failed: %08x\n", GetLastError()); /* check that the store is empty */