diff --git a/dlls/crypt32/protectdata.c b/dlls/crypt32/protectdata.c index d3e0034909..d86dd8e629 100644 --- a/dlls/crypt32/protectdata.c +++ b/dlls/crypt32/protectdata.c @@ -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 */