crypt32: Set lower quality chain count and pointer to 0 when freeing them.

This commit is contained in:
Juan Lang 2007-10-18 20:46:57 -07:00 committed by Alexandre Julliard
parent 5d6feab0e2
commit 9ae5ef6641
1 changed files with 2 additions and 4 deletions

View File

@ -1062,6 +1062,8 @@ static void CRYPT_FreeLowerQualityChains(PCertificateChain chain)
for (i = 0; i < chain->context.cLowerQualityChainContext; i++) for (i = 0; i < chain->context.cLowerQualityChainContext; i++)
CertFreeCertificateChain(chain->context.rgpLowerQualityChainContext[i]); CertFreeCertificateChain(chain->context.rgpLowerQualityChainContext[i]);
CryptMemFree(chain->context.rgpLowerQualityChainContext); CryptMemFree(chain->context.rgpLowerQualityChainContext);
chain->context.cLowerQualityChainContext = 0;
chain->context.rgpLowerQualityChainContext = NULL;
} }
static void CRYPT_FreeChainContext(PCertificateChain chain) static void CRYPT_FreeChainContext(PCertificateChain chain)
@ -1365,11 +1367,7 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine,
} while (ret && alternate); } while (ret && alternate);
chain = CRYPT_ChooseHighestQualityChain(chain); chain = CRYPT_ChooseHighestQualityChain(chain);
if (!(dwFlags & CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS)) if (!(dwFlags & CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS))
{
CRYPT_FreeLowerQualityChains(chain); CRYPT_FreeLowerQualityChains(chain);
chain->context.cLowerQualityChainContext = 0;
chain->context.rgpLowerQualityChainContext = NULL;
}
if (ppChainContext) if (ppChainContext)
*ppChainContext = (PCCERT_CHAIN_CONTEXT)chain; *ppChainContext = (PCCERT_CHAIN_CONTEXT)chain;
else else