[RTEMS Project] #3514: Resource Leak in hexdump-parse.c

RTEMS trac trac at rtems.org
Wed Sep 12 15:23:29 UTC 2018


#3514: Resource Leak in hexdump-parse.c
----------------------------+----------------------
  Reporter:  Joel Sherrill  |      Owner:  (none)
      Type:  defect         |     Status:  new
  Priority:  normal         |  Milestone:  5.1
 Component:  shell          |    Version:  5
  Severity:  normal         |   Keywords:  coverity
Blocked By:                 |   Blocking:
----------------------------+----------------------
 Per Coverity Scan (https://scan.coverity.com/projects/rtems) CID 26032,
 hexdump-parse.c has a resource leak. You will need an Coverity Scan
 account and permission to view RTEMS to see more details.

 This code came from FreeBSD so a first step would be checking if this area
 of the code has changed since it was incorporated into RTEMS. The code in
 question is:

 {{{
 421                }
 422                /*
 423                 * If format unit byte count not specified, figure it
 out
 424                 * so can adjust rep count later.
 425                 */
         14. Condition !fu->bcnt, taking true branch.
 426                if (!fu->bcnt)

 CID 26032 (#2 of 2): Resource leak (RESOURCE_LEAK)
 15. overwrite_var: Overwriting pr in pr = fu->nextpr leaks the storage
 that pr points to.
 427                        for (pr = fu->nextpr; pr; pr = pr->nextpr)
 428                                fu->bcnt += pr->bcnt;
 429        }
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/3514>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list