crypt32: Fix duplicating a NULL CRL context.

This commit is contained in:
Juan Lang 2009-10-20 09:52:36 -07:00 committed by Alexandre Julliard
parent 47ec8ab0f3
commit acc9d81f26
2 changed files with 18 additions and 1 deletions

View File

@ -228,7 +228,8 @@ PCCRL_CONTEXT WINAPI CertGetCRLFromStore(HCERTSTORE hCertStore,
PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT pCrlContext) PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT pCrlContext)
{ {
TRACE("(%p)\n", pCrlContext); TRACE("(%p)\n", pCrlContext);
Context_AddRef((void *)pCrlContext, sizeof(CRL_CONTEXT)); if (pCrlContext)
Context_AddRef((void *)pCrlContext, sizeof(CRL_CONTEXT));
return pCrlContext; return pCrlContext;
} }

View File

@ -118,6 +118,21 @@ static void testCreateCRL(void)
CertFreeCRLContext(context); CertFreeCRLContext(context);
} }
static void testDupCRL(void)
{
PCCRL_CONTEXT context, dupContext;
context = CertDuplicateCRLContext(NULL);
ok(context == NULL, "expected NULL\n");
context = CertCreateCRLContext(X509_ASN_ENCODING, signedCRL,
sizeof(signedCRL));
dupContext = CertDuplicateCRLContext(context);
ok(dupContext != NULL, "expected a context\n");
ok(dupContext == context, "expected identical context addresses\n");
CertFreeCRLContext(dupContext);
CertFreeCRLContext(context);
}
static void testAddCRL(void) static void testAddCRL(void)
{ {
HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
@ -722,6 +737,7 @@ START_TEST(crl)
init_function_pointers(); init_function_pointers();
testCreateCRL(); testCreateCRL();
testDupCRL();
testAddCRL(); testAddCRL();
testFindCRL(); testFindCRL();
testGetCRLFromStore(); testGetCRLFromStore();