Artur Wojcik: Fix for memory leak defect.

Martin F. Krafft madduck at alioth.debian.org
Wed Jan 27 02:03:54 UTC 2010


Module: mdadm
Branch: upstream
Commit: 1602d52c99aff727440e1015411c6566736aaf7f
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=1602d52c99aff727440e1015411c6566736aaf7f

Author: Artur Wojcik <artur.wojcik at intel.com>
Date:   Thu Dec 10 12:03:40 2009 -0700

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 at intel.com>
Signed-off-by: Dan Williams <dan.j.williams at intel.com>

---

 super-intel.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index fbde7e6..5c967b2 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -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;




More information about the pkg-mdadm-commits mailing list