summaryrefslogtreecommitdiff
path: root/test/log
diff options
context:
space:
mode:
authorUmang Jain <email@uajain.com>2020-05-15 12:42:53 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-06-04 11:02:38 +0100
commit3706b716eba66e77c27ab365f54e6b13f145fea8 (patch)
tree1c60316e76dc51324d140d4fedc15434de086754 /test/log
parent5bb6607933f28d2484b68034f871cd58074ae695 (diff)
test: log: log_api: Close open fds on error paths
Reported-by: Coverity CID=279091 Signed-off-by: Umang Jain <email@uajain.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'test/log')
-rw-r--r--test/log/log_api.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/log/log_api.cpp b/test/log/log_api.cpp
index 6f3248a7..ae3c607a 100644
--- a/test/log/log_api.cpp
+++ b/test/log/log_api.cpp
@@ -87,6 +87,7 @@ protected:
if (logSetFile(path) < 0) {
cerr << "Failed to set log file" << endl;
+ close(fd);
return TestFail;
}
@@ -97,6 +98,7 @@ protected:
lseek(fd, 0, SEEK_SET);
if (read(fd, buf, sizeof(buf)) < 0) {
cerr << "Failed to read tmp log file" << endl;
+ close(fd);
return TestFail;
}
close(fd);