crypt32: Don't assign a count value unless memory allocation succeeds (clang).

This commit is contained in:
Juan Lang 2011-02-15 11:31:16 -08:00 committed by Alexandre Julliard
parent b377f83453
commit 3cdd20f91d
1 changed files with 3 additions and 1 deletions

View File

@ -1330,13 +1330,15 @@ static BOOL CRYPT_AsnEncodeRdn(DWORD dwCertEncodingType, const CERT_RDN *rdn,
ret = TRUE;
if (rdn->cRDNAttr)
{
setOf.cBlob = rdn->cRDNAttr;
setOf.rgBlob = CryptMemAlloc(rdn->cRDNAttr *
sizeof(CRYPT_DER_BLOB));
if (!setOf.rgBlob)
ret = FALSE;
else
{
setOf.cBlob = rdn->cRDNAttr;
memset(setOf.rgBlob, 0, setOf.cBlob * sizeof(CRYPT_DER_BLOB));
}
}
for (i = 0; ret && i < rdn->cRDNAttr; i++)
{