From a375e1acfd41432cc5a6be3de20067cce7dee5fd Mon Sep 17 00:00:00 2001 From: "Bryon Gloden, CISSPĀ®" Date: Thu, 4 Aug 2016 15:26:27 -0400 Subject: 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 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; } -- cgit v1.2.3