unittest: Fix two issues reported by Coverity Scan (CID 1402761, 1402755)

GTEST_SKIP() returns from the function which caused two warnings:

CID 1402755 (#1 of 1): Resource leak (RESOURCE_LEAK)
CID 1402761 (#1 of 1): Structurally dead code (UNREACHABLE)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-07-10 16:38:30 +02:00
parent a85045eeb5
commit d40a2423e8

View File

@ -31,14 +31,12 @@ TEST_F(ScanutilsTest, DoesScanf) {
if (fp1 == nullptr) {
std::cout << "Failed to open file " << filename << '\n';
GTEST_SKIP();
return;
}
FILE* fp2 = fopen(filename.c_str(), "r");
if (fp2 == nullptr) {
std::cout << "Failed to open file " << filename << '\n';
GTEST_SKIP();
fclose(fp1);
return;
GTEST_SKIP();
}
// The file contains this:
// 42.5 17 0.001000 -0.001000