diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2022-02-23 11:04:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-23 11:04:29 (GMT) |
commit | c5e509481f1e53ceedc21d0315e125895b24d68d (patch) | |
tree | 48c46b02eb7ad7953769f99a559e7773feacdc88 /src/util.cc | |
parent | 170c387a7461d476523ae29c115a58f16e4d3430 (diff) | |
parent | 9116613e39ba4e18f50494e97eb968a874effdcf (diff) | |
download | Ninja-c5e509481f1e53ceedc21d0315e125895b24d68d.zip Ninja-c5e509481f1e53ceedc21d0315e125895b24d68d.tar.gz Ninja-c5e509481f1e53ceedc21d0315e125895b24d68d.tar.bz2 |
Merge pull request #2088 from digit-google/fix-ReadFile-handle-leak
Fix ReadFile() handle leak on read error on Windows.
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util.cc b/src/util.cc index 080883e..a2a0f27 100644 --- a/src/util.cc +++ b/src/util.cc @@ -350,7 +350,8 @@ int ReadFile(const string& path, string* contents, string* err) { if (!::ReadFile(f, buf, sizeof(buf), &len, NULL)) { err->assign(GetLastErrorString()); contents->clear(); - return -1; + ::CloseHandle(f); + return -EIO; } if (len == 0) break; |