Opened on 10/25/18 at 23:02:58
Last modified on 10/25/18 at 23:30:03
#3570 new defect
Resource leak in flashdisk.c (CID 1439298)
Reported by: | embeddedt | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | Indefinite |
Component: | admin | Version: | 6 |
Severity: | normal | Keywords: | Coverity |
Cc: | Blocked By: | ||
Blocking: |
Description
Coverity Scan (https://scan.coverity.com/projects/rtems) reports a resource leak in flashdisk.c. You need a Coverity Scan account and access to the RTEMS project to see more details.
It appears that there are a cluster of issues here. The function tries to allocate memory but when any single allocation fails, the previous allocations are not freed.
Here is one example:
2496 fd->devices = calloc (c->device_count, sizeof (rtems_fdisk_device_ctl)); 2497 if (!fd->devices) CID 1439298 (#1 of 2): Resource leak (RESOURCE_LEAK) 2498 return RTEMS_NO_MEMORY;
As you can see, on line 2498 it returns without freeing fd
(which was allocated on line 2457) and several other allocations in between these lines.
Viewing CID 1439298 on Coverity Scan will give more details.
Note: See
TracTickets for help on using
tickets.
Please use this information from Coverity:
There are two places where my mentor noticed a potential leak but these would require further investigation. They are at lines 2568 and 2581.