#4420 closed defect (fixed)

TraceWriterQEMU.cc: Resource leak error spotted by Coverity

Reported by: Ryan Long Owned by: Ryan Long <ryan.long@…>
Priority: normal Milestone: 6.1
Component: tool Version: 6
Severity: normal Keywords: Coverity
Cc: Blocked By:
Blocking:

Description

CID 1399621: Resource leak in writeFile().

   5. noescape: Resource traceFile is not freed or pointed-to in fwrite.
116    status = ::fwrite( &header, sizeof(trace_header), 1, traceFile );
   6. Condition status != 1, taking true branch.
117    if (status != 1) {
118      std::cerr << "Unable to write header to " << file << std::endl;
   CID 1399621 (#1 of 1): Resource leak (RESOURCE_LEAK)7. leaked_storage: Variable traceFile going out of scope leaks the storage it points to.
119      return false;

Change History (2)

comment:1 Changed on 05/18/21 at 15:55:13 by Ryan Long

Keywords: Coverity added

comment:2 Changed on 06/04/21 at 17:23:24 by Ryan Long <ryan.long@…>

Owner: set to Ryan Long <ryan.long@…>
Resolution: fixed
Status: newclosed

In a0b54f0/rtems-tools:

TraceWriterQEMU.cc: Fix resource leak

CID 1399621: Resource leak in writeFile().

Closes #4420

Note: See TracTickets for help on using tickets.