summaryrefslogtreecommitdiff
path: root/Incremental.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2011-11-01 14:51:30 +1100
committerNeilBrown <neilb@suse.de>2011-11-01 14:51:30 +1100
commit1fdeb8a08457c80cec0d067d0916e2b9159a55ce (patch)
tree9a05a4ae85068e978f8d53003fc8b0e680a123d6 /Incremental.c
parent5454b6f32475048a7fbc59e25701361985dc0299 (diff)
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>
Diffstat (limited to 'Incremental.c')
-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);