From fe9e23998ac79239a1f89f22c9aa3295985ff55d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 14 Oct 2013 14:46:27 +0200 Subject: [PATCH] crypt32: Don't call CertFreeCertificateContext in CertDeleteCertificateContext, leave it to store-specific functions. --- dlls/crypt32/collectionstore.c | 25 ++++--------------------- dlls/crypt32/store.c | 5 ----- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/dlls/crypt32/collectionstore.c b/dlls/crypt32/collectionstore.c index 10dd6c1ea96..f8dbf6e9b0b 100644 --- a/dlls/crypt32/collectionstore.c +++ b/dlls/crypt32/collectionstore.c @@ -271,15 +271,9 @@ static BOOL Collection_deleteCert(WINECRYPT_CERTSTORE *store, void *pCertContext TRACE("(%p, %p)\n", store, pCertContext); - /* Deleting the linked context results in its ref count getting - * decreased, but the caller of this (CertDeleteCertificateFromStore) also - * decreases pCertContext's ref count, by calling - * CertFreeCertificateContext. Increase ref count of linked context to - * compensate. - */ linked = Context_GetLinkedContext(pCertContext); - CertDuplicateCertificateContext(linked); ret = CertDeleteCertificateFromStore(linked); + CertFreeCertificateContext(pCertContext); return ret; } @@ -356,14 +350,9 @@ static BOOL Collection_deleteCRL(WINECRYPT_CERTSTORE *store, void *pCrlContext) TRACE("(%p, %p)\n", store, pCrlContext); - /* Deleting the linked context results in its ref count getting - * decreased, but the caller of this (CertDeleteCRLFromStore) also - * decreases pCrlContext's ref count, by calling CertFreeCRLContext. - * Increase ref count of linked context to compensate. - */ linked = Context_GetLinkedContext(pCrlContext); - CertDuplicateCRLContext(linked); ret = CertDeleteCRLFromStore(linked); + CertFreeCRLContext(pCrlContext); return ret; } @@ -432,22 +421,16 @@ static void *Collection_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev) return ret; } -static BOOL Collection_deleteCTL(WINECRYPT_CERTSTORE *store, - void *pCtlContext) +static BOOL Collection_deleteCTL(WINECRYPT_CERTSTORE *store, void *pCtlContext) { BOOL ret; PCCTL_CONTEXT linked; TRACE("(%p, %p)\n", store, pCtlContext); - /* Deleting the linked context results in its ref count getting - * decreased, but the caller of this (CertDeleteCTLFromStore) also - * decreases pCtlContext's ref count, by calling CertFreeCTLContext. - * Increase ref count of linked context to compensate. - */ linked = Context_GetLinkedContext(pCtlContext); - CertDuplicateCTLContext(linked); ret = CertDeleteCTLFromStore(linked); + CertFreeCTLContext(pCtlContext); return ret; } diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 496c7a8c101..1054b044398 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -1060,15 +1060,10 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext) ret = FALSE; else ret = hcs->vtbl->certs.deleteContext(hcs, (void *)pCertContext); - if (ret) - ret = CertFreeCertificateContext(pCertContext); } return ret; } -#define CrlContext_CopyProperties(to, from) \ - Context_CopyProperties((to), (from), sizeof(CRL_CONTEXT)) - BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pCrlContext, DWORD dwAddDisposition, PCCRL_CONTEXT* ppStoreContext)