From 5b8d0a7aa9eebcfc33c064aa91e1ea7c59ff61a5 Mon Sep 17 00:00:00 2001 From: vitaut Date: Tue, 4 Aug 2015 07:22:03 -0700 Subject: [PATCH] Make Coverity happy --- test/format-test.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/format-test.cc b/test/format-test.cc index 4f6597a4..35d96b45 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1447,12 +1447,14 @@ TEST(FormatterTest, FormatExamples) { const char *filename = "nonexistent"; FILE *ftest = safe_fopen(filename, "r"); + if (ftest) fclose(ftest); int error_code = errno; EXPECT_TRUE(ftest == 0); EXPECT_SYSTEM_ERROR({ FILE *f = safe_fopen(filename, "r"); if (!f) throw fmt::SystemError(errno, "Cannot open file '{}'", filename); + fclose(f); }, error_code, "Cannot open file 'nonexistent'"); }