crypt32: Propagate errors from CertFree*Context to CertDelete*FromStore.

This commit is contained in:
Juan Lang 2009-10-30 15:18:53 -07:00 committed by Alexandre Julliard
parent 40855cae97
commit 92324ab38e
3 changed files with 9 additions and 15 deletions

View File

@ -309,10 +309,7 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
if (!pCtlContext) if (!pCtlContext)
ret = TRUE; ret = TRUE;
else if (!pCtlContext->hCertStore) else if (!pCtlContext->hCertStore)
{ ret = CertFreeCTLContext(pCtlContext);
ret = TRUE;
CertFreeCTLContext(pCtlContext);
}
else else
{ {
PWINECRYPT_CERTSTORE hcs = pCtlContext->hCertStore; PWINECRYPT_CERTSTORE hcs = pCtlContext->hCertStore;
@ -321,7 +318,8 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
ret = FALSE; ret = FALSE;
else else
ret = hcs->ctls.deleteContext(hcs, (void *)pCtlContext); ret = hcs->ctls.deleteContext(hcs, (void *)pCtlContext);
CertFreeCTLContext(pCtlContext); if (ret)
ret = CertFreeCTLContext(pCtlContext);
} }
return ret; return ret;
} }

View File

@ -966,10 +966,7 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
if (!pCertContext) if (!pCertContext)
ret = TRUE; ret = TRUE;
else if (!pCertContext->hCertStore) else if (!pCertContext->hCertStore)
{ ret = CertFreeCertificateContext(pCertContext);
ret = TRUE;
CertFreeCertificateContext(pCertContext);
}
else else
{ {
PWINECRYPT_CERTSTORE hcs = pCertContext->hCertStore; PWINECRYPT_CERTSTORE hcs = pCertContext->hCertStore;
@ -979,7 +976,7 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
else else
ret = hcs->certs.deleteContext(hcs, (void *)pCertContext); ret = hcs->certs.deleteContext(hcs, (void *)pCertContext);
if (ret) if (ret)
CertFreeCertificateContext(pCertContext); ret = CertFreeCertificateContext(pCertContext);
} }
return ret; return ret;
} }
@ -1105,10 +1102,7 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
if (!pCrlContext) if (!pCrlContext)
ret = TRUE; ret = TRUE;
else if (!pCrlContext->hCertStore) else if (!pCrlContext->hCertStore)
{ ret = CertFreeCRLContext(pCrlContext);
ret = TRUE;
CertFreeCRLContext(pCrlContext);
}
else else
{ {
PWINECRYPT_CERTSTORE hcs = pCrlContext->hCertStore; PWINECRYPT_CERTSTORE hcs = pCrlContext->hCertStore;
@ -1117,7 +1111,8 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
ret = FALSE; ret = FALSE;
else else
ret = hcs->crls.deleteContext(hcs, (void *)pCrlContext); ret = hcs->crls.deleteContext(hcs, (void *)pCrlContext);
CertFreeCRLContext(pCrlContext); if (ret)
ret = CertFreeCRLContext(pCrlContext);
} }
return ret; return ret;
} }

View File

@ -237,6 +237,7 @@ static void testMemStore(void)
GetLastError()); GetLastError());
/* try deleting a copy */ /* try deleting a copy */
ret = CertDeleteCertificateFromStore(copy); ret = CertDeleteCertificateFromStore(copy);
todo_wine
ok(ret, "CertDeleteCertificateFromStore failed: %08x\n", ok(ret, "CertDeleteCertificateFromStore failed: %08x\n",
GetLastError()); GetLastError());
/* check that the store is empty */ /* check that the store is empty */