Module: wine Branch: master Commit: 99a81e18434e6e4aae50628ad0803cf753397c22 URL: http://source.winehq.org/git/wine.git/?a=commit;h=99a81e18434e6e4aae50628ad0...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Tue Oct 29 16:09:05 2013 +0900
crypt32: Check number of bytes returned by ReadFile and avoid a memory leak on error path.
---
dlls/crypt32/object.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/dlls/crypt32/object.c b/dlls/crypt32/object.c index 0ff1bfd..39955ce 100644 --- a/dlls/crypt32/object.c +++ b/dlls/crypt32/object.c @@ -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);