crypt32: Don't free a certificate that hasn't been removed from its store

Juan Lang juan.lang at gmail.com
Mon Aug 10 13:02:22 CDT 2009


This fixes a crash Aurimas reported deleting a certificate from the root store.
--Juan
-------------- next part --------------
From 3c1d2306ec33b7a5b8f8311d0ac473d475b74dba Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Mon, 10 Aug 2009 10:42:55 -0700
Subject: [PATCH 10/10] Don't free a certificate that hasn't been removed from its store

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

diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index e043315..8acc6f6 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -978,7 +978,8 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
             ret = FALSE;
         else
             ret = hcs->certs.deleteContext(hcs, (void *)pCertContext);
-        CertFreeCertificateContext(pCertContext);
+        if (ret)
+            CertFreeCertificateContext(pCertContext);
     }
     return ret;
 }
-- 
1.6.3.2


More information about the wine-patches mailing list