Jacek Caban : crypt32: Don' t call CertFreeCertificateContext in CertDeleteCertificateContext, leave it to store-specific functions.

Alexandre Julliard julliard at winehq.org
Mon Oct 14 12:39:29 CDT 2013


Module: wine
Branch: master
Commit: fe9e23998ac79239a1f89f22c9aa3295985ff55d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fe9e23998ac79239a1f89f22c9aa3295985ff55d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Oct 14 14:46:27 2013 +0200

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 10dd6c1..f8dbf6e 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 496c7a8..1054b04 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)




More information about the wine-cvs mailing list