crypt32: Check number of bytes returned by ReadFile and avoid a memory leak on error path.

This commit is contained in:
Dmitry Timoshkov 2013-10-29 16:09:05 +09:00 committed by Alexandre Julliard
parent d95797e170
commit 99a81e1843
1 changed files with 2 additions and 1 deletions

View File

@ -52,7 +52,8 @@ static BOOL CRYPT_ReadBlobFromFile(LPCWSTR fileName, PCERT_BLOB blob)
{
DWORD read;
ret = ReadFile(file, blob->pbData, blob->cbData, &read, NULL);
ret = ReadFile(file, blob->pbData, blob->cbData, &read, NULL) && read == blob->cbData;
if (!ret) CryptMemFree(blob->pbData);
}
}
CloseHandle(file);