diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-06-21 16:27:12 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-06-21 16:27:12 +0000 |
commit | 54a3c4decaa3eafa89b03079715d7f188bb51dbb (patch) | |
tree | 1d68eb13e8b37589ec5a2ca93c9526134d53a2be /cpukit | |
parent | 2010-06-21 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff) | |
download | rtems-54a3c4decaa3eafa89b03079715d7f188bb51dbb.tar.bz2 |
2010-06-21 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1554/cpukit
Coverity Id 17
* libi2c/libi2c.c: Fix memory leak on error.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 6 | ||||
-rw-r--r-- | cpukit/libi2c/libi2c.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 9d1324cd72..914d98a0d4 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,11 @@ 2010-06-21 Joel Sherrill <joel.sherrilL@OARcorp.com> + PR 1554/cpukit + Coverity Id 17 + * libi2c/libi2c.c: Fix memory leak on error. + +2010-06-21 Joel Sherrill <joel.sherrilL@OARcorp.com> + PR 1559/misc Coverity Id 16 * libmisc/monitor/mon-editor.c: Fix buffer overflow. diff --git a/cpukit/libi2c/libi2c.c b/cpukit/libi2c/libi2c.c index e43e667e3d..98dd6678f4 100644 --- a/cpukit/libi2c/libi2c.c +++ b/cpukit/libi2c/libi2c.c @@ -395,11 +395,13 @@ rtems_libi2c_register_bus (const char *name, rtems_libi2c_bus_t * bus) /* check */ if ('/' != *nmcpy) { safe_printf ( DRVNM "Bad name: must be an absolute path starting with '/'\n"); + free( nmcpy ); return -RTEMS_INVALID_NAME; } /* file must not exist */ if (!stat (nmcpy, &sbuf)) { safe_printf ( DRVNM "Bad name: file exists already\n"); + free( nmcpy ); return -RTEMS_INVALID_NAME; } @@ -412,6 +414,7 @@ rtems_libi2c_register_bus (const char *name, rtems_libi2c_bus_t * bus) if (i) { safe_printf ( DRVNM "Get %s status failed: %s\n", nmcpy, strerror(errno)); + free( nmcpy ); return -RTEMS_INVALID_NAME; } /* should be a directory since name terminates in '/' */ @@ -419,11 +422,13 @@ rtems_libi2c_register_bus (const char *name, rtems_libi2c_bus_t * bus) if (libmutex == RTEMS_ID_NONE) { safe_printf ( DRVNM "Library not initialized\n"); + free( nmcpy ); return -RTEMS_NOT_DEFINED; } if (bus == NULL || bus->size < sizeof (*bus)) { safe_printf ( DRVNM "No bus-ops or size too small -- misconfiguration?\n"); + free( nmcpy ); return -RTEMS_NOT_CONFIGURED; } |