[PATCH] [Crypt32]: various fixes spotted by Valgrind

Eric Pouech eric.pouech at wanadoo.fr
Mon Feb 27 15:24:59 CST 2006


- don't access a blob after freeing it

A+
---

 dlls/crypt32/oid.c   |    2 +-
 dlls/crypt32/store.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/crypt32/oid.c b/dlls/crypt32/oid.c
index 6067bdf..3a11495 100644
--- a/dlls/crypt32/oid.c
+++ b/dlls/crypt32/oid.c
@@ -84,7 +84,6 @@ static void free_function_sets(void)
 
         list_remove(&setCursor->next);
         CryptMemFree(setCursor->name);
-        CryptMemFree(setCursor);
         LIST_FOR_EACH_ENTRY_SAFE(functionCursor, funcNext,
          &setCursor->functions, struct OIDFunction, next)
         {
@@ -92,6 +91,7 @@ static void free_function_sets(void)
             CryptMemFree(functionCursor);
         }
         DeleteCriticalSection(&setCursor->cs);
+        CryptMemFree(setCursor);
     }
     DeleteCriticalSection(&funcSetCS);
 }
diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index 348bca8..444d9c3 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -534,8 +534,8 @@ static BOOL WINAPI CRYPT_MemDeleteCert(H
              * protected.
              */
             list_remove(&cert->entry);
-            ret = CertFreeCertificateContext((PCCERT_CONTEXT)cert);
             cert->entry.prev = cert->entry.next = &store->certs;
+            ret = CertFreeCertificateContext((PCCERT_CONTEXT)cert);
             break;
         }
     }





More information about the wine-patches mailing list