summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2011-11-01 04:51:30 +0100
committerNeilBrown <neilb@suse.de>2011-11-01 04:51:30 +0100
commit1fdeb8a08457c80cec0d067d0916e2b9159a55ce (patch)
tree9a05a4ae85068e978f8d53003fc8b0e680a123d6
parentFix memory leak (diff)
downloadmdadm-1fdeb8a08457c80cec0d067d0916e2b9159a55ce.tar.xz
mdadm-1fdeb8a08457c80cec0d067d0916e2b9159a55ce.zip
Fix memory leak of 'st3' in array_try_spare()
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--Incremental.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Incremental.c b/Incremental.c
index b5d3e025..cedb7928 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -878,8 +878,10 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
* to obtain minimum spare size */
struct supertype *st3 = dup_super(st2);
int mdfd = open_dev(mp->devnum);
- if (!mdfd)
+ if (!mdfd) {
+ free(st3);
goto next;
+ }
if (st3->ss->load_container &&
!st3->ss->load_container(st3, mdfd, mp->path)) {
component_size = st3->ss->min_acceptable_spare_size(st3);