aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Xiao <xiaofeng@google.com>2016-08-05 15:28:42 -0700
committerGitHub <noreply@github.com>2016-08-05 15:28:42 -0700
commit1102a8a7675d6b718e81b28a10173a2e073c3820 (patch)
treef5f310bc1c85b5ba160ee0f507c6ea69e5ef6108
parente30b7b446175c75cc85beca9015685c6f7705af4 (diff)
parenta375e1acfd41432cc5a6be3de20067cce7dee5fd (diff)
downloadprotobuf-1102a8a7675d6b718e81b28a10173a2e073c3820.tar.gz
protobuf-1102a8a7675d6b718e81b28a10173a2e073c3820.tar.bz2
protobuf-1102a8a7675d6b718e81b28a10173a2e073c3820.zip
Merge pull request #1923 from bryongloden/patch-1
close opened file descriptors properly
-rw-r--r--src/google/protobuf/testing/file.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/google/protobuf/testing/file.cc b/src/google/protobuf/testing/file.cc
index 3d07b127..bc76c844 100644
--- a/src/google/protobuf/testing/file.cc
+++ b/src/google/protobuf/testing/file.cc
@@ -91,6 +91,7 @@ bool File::WriteStringToFile(const string& contents, const string& name) {
if (fwrite(contents.data(), 1, contents.size(), file) != contents.size()) {
GOOGLE_LOG(ERROR) << "fwrite(" << name << "): " << strerror(errno);
+ fclose(file);
return false;
}