crypt32(11/13): Release contexts when removing them from the mem store

View: New views
1 Messages — Rating Filter:   Alert me  

crypt32(11/13): Release contexts when removing them from the mem store

by Juan Lang-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Taken together, this patch and the last accomplish nothing other than
moving the call location of freeing a context.  The real fix comes in
the next patch.  I separated them this way to make the next patch
smaller.
--Juan

[0011-Release-contexts-when-removing-them-from-the-mem-sto.patch]

From 90478bf37885b57c9f299f95dbf434e3ffcff2b7 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang@...>
Date: Fri, 30 Oct 2009 18:48:22 -0700
Subject: [PATCH] Release contexts when removing them from the mem store

---
 dlls/crypt32/store.c       |    6 +++---
 dlls/crypt32/tests/store.c |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index a529ac6..deb0520 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -186,7 +186,7 @@ static BOOL CRYPT_MemDeleteCert(PWINECRYPT_CERTSTORE store, void *pCertContext)
     WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
 
     ContextList_Delete(ms->certs, pCertContext);
-    return TRUE;
+    return CertFreeCertificateContext(pCertContext);
 }
 
 static BOOL CRYPT_MemAddCrl(PWINECRYPT_CERTSTORE store, void *crl,
@@ -227,7 +227,7 @@ static BOOL CRYPT_MemDeleteCrl(PWINECRYPT_CERTSTORE store, void *pCrlContext)
     WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
 
     ContextList_Delete(ms->crls, pCrlContext);
-    return TRUE;
+    return CertFreeCRLContext(pCrlContext);
 }
 
 static BOOL CRYPT_MemAddCtl(PWINECRYPT_CERTSTORE store, void *ctl,
@@ -268,7 +268,7 @@ static BOOL CRYPT_MemDeleteCtl(PWINECRYPT_CERTSTORE store, void *pCtlContext)
     WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
 
     ContextList_Delete(ms->ctls, pCtlContext);
-    return TRUE;
+    return CertFreeCTLContext(pCtlContext);
 }
 
 static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c
index 419d2dd..1f6609c 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 */
--
1.6.0.6