summaryrefslogtreecommitdiffstats
path: root/cpukit/libblock
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-01-19 22:09:20 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-01-19 22:09:20 +0000
commitd3231fbaef621f7f11b79085c50c3f343966f693 (patch)
tree96aecaa834f4132b53a4ae73efd5c9c4a8e20e73 /cpukit/libblock
parent2010-01-19 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-d3231fbaef621f7f11b79085c50c3f343966f693.tar.bz2
2010-01-19 Joel Sherrill <joel.sherrill@oarcorp.com>
Coverity Id 24 * libblock/src/ide_part_table.c: Initialize sector to NULL and add free(sector) on error return path from get_sector() to fix potential leak.
Diffstat (limited to 'cpukit/libblock')
-rw-r--r--cpukit/libblock/src/ide_part_table.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpukit/libblock/src/ide_part_table.c b/cpukit/libblock/src/ide_part_table.c
index a864e0959f..c11660b7b6 100644
--- a/cpukit/libblock/src/ide_part_table.c
+++ b/cpukit/libblock/src/ide_part_table.c
@@ -317,7 +317,7 @@ static rtems_status_code
read_mbr(rtems_disk_desc_t *disk_desc)
{
int part_num;
- rtems_sector_data_t *sector;
+ rtems_sector_data_t *sector = NULL;
rtems_part_desc_t *part_desc;
uint8_t *data;
rtems_status_code rc;
@@ -327,6 +327,8 @@ read_mbr(rtems_disk_desc_t *disk_desc)
rc = get_sector(dev, 0, &sector);
if (rc != RTEMS_SUCCESSFUL)
{
+ if (sector)
+ free(sector);
return rc;
}