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:08:59 +09:00 committed by Alexandre Julliard
parent 71168d9dcc
commit d95797e170
1 changed files with 2 additions and 1 deletions

View File

@ -119,7 +119,8 @@ static BOOL CRYPT_ReadBlobFromFile(HANDLE file, 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);
}
}
return ret;