]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix for memory leak defect.
authorArtur Wojcik <artur.wojcik@intel.com>
Thu, 10 Dec 2009 19:03:40 +0000 (12:03 -0700)
committerDan Williams <dan.j.williams@intel.com>
Thu, 10 Dec 2009 19:03:40 +0000 (12:03 -0700)
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>
super-intel.c

index fbde7e69ccd0a2af125fa71f6bbba6f771c5cf7d..5c967b2a15eb21e22fe4d74ab523af5bd28943e2 100644 (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;