mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
2010-06-21 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1554/cpukit Coverity Id 17 * libi2c/libi2c.c: Fix memory leak on error.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2010-06-21 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
||||
|
||||
PR 1554/cpukit
|
||||
Coverity Id 17
|
||||
* libi2c/libi2c.c: Fix memory leak on error.
|
||||
|
||||
2010-03-17 Chris Johns <chrisj@rtems.org>
|
||||
|
||||
* libfs/src/dosfs/msdos_create.c: Fix the date/time call order to
|
||||
|
||||
@@ -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) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user