Fix for memory leak defect.

Possible memory leak. Dynamic memory stored in 'sra' allocated through
function 'sysfs_read' at line 2484 can be lost at lines 2491, 2560 and
2571.

Signed-off-by: Artur Wojcik <artur.wojcik@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Artur Wojcik 2009-12-10 12:03:40 -07:00 committed by Dan Williams
parent e207da2f1b
commit 1602d52c99
1 changed files with 5 additions and 3 deletions

View File

@ -2498,9 +2498,10 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
if (sra->array.major_version != -1 ||
sra->array.minor_version != -2 ||
strcmp(sra->text_version, "imsm") != 0)
return 1;
strcmp(sra->text_version, "imsm") != 0) {
err = 1;
goto error;
}
/* load all mpbs */
for (sd = sra->devs, i = 0; sd; sd = sd->next, i++) {
struct intel_super *s = alloc_super(0);
@ -2566,6 +2567,7 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
super_list = super_list->next;
free_imsm(s);
}
sysfs_free(sra);
if (err)
return err;