From 3706b716eba66e77c27ab365f54e6b13f145fea8 Mon Sep 17 00:00:00 2001 From: Umang Jain Date: Fri, 15 May 2020 12:42:53 +0000 Subject: test: log: log_api: Close open fds on error paths Reported-by: Coverity CID=279091 Signed-off-by: Umang Jain Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- test/log/log_api.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/log') 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); -- cgit v1.2.1