diff options
author | Evan Martin <martine@danga.com> | 2012-03-13 22:12:57 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2012-03-13 22:12:57 (GMT) |
commit | 475417d0de9540c4507652984d3737eeb45e4007 (patch) | |
tree | 34ebd5a9dc0bcc39b6c24ad2bcb1399ff610c1df /src | |
parent | eca6bbe32bf3d1263ed1173a774f9d91c9b0f415 (diff) | |
parent | 2bee4d1fed582d8c82df271655081e6206fe7f59 (diff) | |
download | Ninja-475417d0de9540c4507652984d3737eeb45e4007.zip Ninja-475417d0de9540c4507652984d3737eeb45e4007.tar.gz Ninja-475417d0de9540c4507652984d3737eeb45e4007.tar.bz2 |
Merge pull request #246 from HeisSpiter/master
Fix resources leaks
Diffstat (limited to 'src')
-rw-r--r-- | src/build_log.cc | 1 | ||||
-rw-r--r-- | src/disk_interface.cc | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/build_log.cc b/src/build_log.cc index 4b93931..fd93ea8 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -221,6 +221,7 @@ bool BuildLog::Recompact(const string& path, string* err) { if (fprintf(f, kFileSignature, kCurrentVersion) < 0) { *err = strerror(errno); + fclose(f); return false; } diff --git a/src/disk_interface.cc b/src/disk_interface.cc index b1a1746..5a36685 100644 --- a/src/disk_interface.cc +++ b/src/disk_interface.cc @@ -109,9 +109,10 @@ bool RealDiskInterface::WriteFile(const string & path, const string & contents) Error("WriteFile(%s): Unable to create file. %s", path.c_str(), strerror(errno)); return false; } - + if (fwrite(contents.data(), 1, contents.length(), fp) < contents.length()) { Error("WriteFile(%s): Unable to write to the file. %s", path.c_str(), strerror(errno)); + fclose(fp); return false; } |