[PATCH v1 4/6] TraceWriterQEMU.cc: Fix resource leak

Ryan Long ryan.long at oarcorp.com
Fri May 28 20:08:16 UTC 2021


CID 1399621: Resource leak in writeFile().

Closes #4420
---
 tester/covoar/TraceWriterQEMU.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tester/covoar/TraceWriterQEMU.cc b/tester/covoar/TraceWriterQEMU.cc
index 4bc9667..26447af 100644
--- a/tester/covoar/TraceWriterQEMU.cc
+++ b/tester/covoar/TraceWriterQEMU.cc
@@ -116,6 +116,7 @@ namespace Trace {
     status = ::fwrite( &header, sizeof(trace_header), 1, traceFile );
     if (status != 1) {
       std::cerr << "Unable to write header to " << file << std::endl;
+      ::fclose( traceFile );
       return false;
     }
 
-- 
1.8.3.1



More information about the devel mailing list