crypt32: Avoid NULL ptr dereferences before checks (Coverity).

oldstable
Marcus Meissner 2013-10-26 10:33:23 +02:00 committed by Alexandre Julliard
parent eeefed3dd0
commit cf1bbb3bb8
2 changed files with 9 additions and 3 deletions

View File

@ -341,7 +341,7 @@ PCCTL_CONTEXT WINAPI CertFindCTLInStore(HCERTSTORE hCertStore,
BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
{
WINECRYPT_CERTSTORE *hcs = pCtlContext->hCertStore;
WINECRYPT_CERTSTORE *hcs;
ctl_t *ctl = ctl_from_ptr(pCtlContext);
BOOL ret;
@ -350,6 +350,8 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
if (!pCtlContext)
return TRUE;
hcs = pCtlContext->hCertStore;
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE;

View File

@ -949,13 +949,15 @@ PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_
BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
{
WINECRYPT_CERTSTORE *hcs = pCertContext->hCertStore;
WINECRYPT_CERTSTORE *hcs;
TRACE("(%p)\n", pCertContext);
if (!pCertContext)
return TRUE;
hcs = pCertContext->hCertStore;
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE;
@ -1084,7 +1086,7 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore,
BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
{
WINECRYPT_CERTSTORE *hcs = pCrlContext->hCertStore;
WINECRYPT_CERTSTORE *hcs;
BOOL ret;
TRACE("(%p)\n", pCrlContext);
@ -1092,6 +1094,8 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
if (!pCrlContext)
return TRUE;
hcs = pCrlContext->hCertStore;
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE;