[libcamera-devel,v2,2/4] test: log: log_process: Close open fds on error paths

Message ID 20200515124245.18040-3-email@uajain.com
State Accepted
Headers show
Series
  • Coverity scan fixes
Related show

Commit Message

Umang Jain May 15, 2020, 12:42 p.m. UTC
Pointed out by Coverity DefectId=279097

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 test/log/log_process.cpp | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/test/log/log_process.cpp b/test/log/log_process.cpp
index 2df4aa4..88baa27 100644
--- a/test/log/log_process.cpp
+++ b/test/log/log_process.cpp
@@ -106,6 +106,7 @@  protected:
 		memset(buf, 0, sizeof(buf));
 		if (read(fd, buf, sizeof(buf)) < 0) {
 			cerr << "Failed to read tmp log file" << endl;
+			close(fd);
 			return TestFail;
 		}
 		close(fd);