#2331 assigned defect

c/src/lib/libbsp/sparc/shared/1553/gr1553b.c: 2 * memory leak ?

Reported by: David Binderman Owned by: Daniel Hellstrom
Priority: normal Milestone: 4.11.4
Component: arch/sparc Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

1.

[rtems/c/src/lib/libbsp/sparc/shared/1553/gr1553b.c:231]: (error) Memory leak: priv

if ( ambadev == NULL ) {

return DRVMGR_FAIL;

}

2.

[rtems/c/src/lib/libbsp/sparc/shared/1553/gr1553b.c:260]: (error) Memory leak: priv

return DRVMGR_OK;

}

Change History (10)

comment:1 Changed on Apr 20, 2015 at 4:04:11 PM by Gedare

Owner: set to Daniel Hellstrom
Status: newassigned

comment:2 Changed on Apr 20, 2015 at 4:04:57 PM by Joel Sherrill

I believe case 1 is a leak on the error case.

Case 2 looks OK. The two malloc'ed chunks of memory have been placed on a list for future use.

Are two free's called on the close path?

comment:3 Changed on Apr 28, 2015 at 8:18:09 AM by Daniel Hellstrom

case 1 is a memory leak. It should be safe for the driver to assume that dev->businfo always is initialized, setting it to NULL makes no sense when a device have been created. Rather it should check if the APB registers are present.

case 2. is ok as Joel points out.

The driver does not implement the drvmgr device remove() function, so the memory is never freed.

I will suggest a pacth.

comment:4 Changed on Jan 26, 2017 at 7:16:00 AM by Sebastian Huber

Milestone: 4.11.14.11.2

comment:5 Changed on Mar 23, 2017 at 1:03:28 AM by Chris Johns

Milestone: 4.11.24.11.3

The 4.11.2 milestone is closing.

comment:6 Changed on Mar 23, 2017 at 1:05:42 AM by Chris Johns

Version: 4.104.11

Move to the 4.11 branch.

comment:8 Changed on Feb 5, 2018 at 5:54:09 AM by Chris Johns

Should this change also be fixed on the 4.11 branch?

comment:9 Changed on Feb 7, 2018 at 10:01:28 PM by Chris Johns

Component: unspecifiedarch/sparc

comment:10 Changed on Feb 11, 2018 at 11:40:41 PM by Chris Johns

Milestone: 4.11.34.11.4

Move to the next milestone and Daniel will resolved them for the next release.

Note: See TracTickets for help on using tickets.