Module: wine
Branch: refs/heads/master
Commit: 769a52f8319668f2f717c1341b0760964637767d
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=769a52f8319668f2f717c13…
Author: Juan Lang <juan_lang(a)yahoo.com>
Date: Mon May 15 17:00:06 2006 -0700
crypt32: Avoid a use-after-free bug in tests.
---
dlls/crypt32/tests/store.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c
index e798ce4..6df1ea2 100644
--- a/dlls/crypt32/tests/store.c
+++ b/dlls/crypt32/tests/store.c
@@ -149,6 +149,10 @@ static void testAddCert(void)
CRYPT_DATA_BLOB hash = { sizeof(bigCert2Hash),
(LPBYTE)bigCert2Hash };
+ /* Duplicate (AddRef) the context so we can still use it after
+ * deleting it from the store.
+ */
+ CertDuplicateCertificateContext(context);
CertDeleteCertificateFromStore(context);
/* Set the same hash as bigCert2, and try to readd it */
ret = CertSetCertificateContextProperty(context, CERT_HASH_PROP_ID,