crypt32: Avoid a use-after-free bug in tests.

This commit is contained in:
Juan Lang 2006-05-15 17:00:06 -07:00 committed by Alexandre Julliard
parent 2eec6b04c0
commit 769a52f831
1 changed files with 4 additions and 0 deletions

View File

@ -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,