crypt32: Don't set salt's cbData unless allocation succeeds. Fixes Coverity id 133.

This commit is contained in:
Juan Lang 2008-09-10 09:39:23 -07:00 committed by Alexandre Julliard
parent 84266fc6f6
commit c958a71df9

View File

@ -607,8 +607,7 @@ BOOL fill_protect_data(struct protect_data_t * pInfo, LPCWSTR szDataDescr,
pInfo->hash_len=CRYPT32_PROTECTDATA_HASH_LEN;
/* allocate memory to hold a salt */
pInfo->salt.cbData=CRYPT32_PROTECTDATA_SALT_LEN;
if ((pInfo->salt.pbData=CryptMemAlloc(pInfo->salt.cbData)))
if ((pInfo->salt.pbData=CryptMemAlloc(CRYPT32_PROTECTDATA_SALT_LEN)))
{
/* generate random salt */
if (!CryptGenRandom(hProv, pInfo->salt.cbData, pInfo->salt.pbData))
@ -617,6 +616,7 @@ BOOL fill_protect_data(struct protect_data_t * pInfo, LPCWSTR szDataDescr,
free_protect_data(pInfo);
return FALSE;
}
pInfo->salt.cbData=CRYPT32_PROTECTDATA_SALT_LEN;
}
/* debug: show our salt */