From a375e1acfd41432cc5a6be3de20067cce7dee5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bryon=20Gloden=2C=20CISSP=C2=AE?= Date: Thu, 4 Aug 2016 15:26:27 -0400 Subject: [PATCH] close opened file descriptors properly --- src/google/protobuf/testing/file.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/google/protobuf/testing/file.cc b/src/google/protobuf/testing/file.cc index 3d07b1276c..bc76c844aa 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; }