Assemble(): don't dup_super() before we need it.

Avoid resource leak in case we bail loop early

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Jes Sorensen 2011-11-01 16:09:24 +01:00 committed by NeilBrown
parent 730ae51fdd
commit 518a60f385
1 changed files with 3 additions and 1 deletions

View File

@ -293,7 +293,7 @@ int Assemble(struct supertype *st, char *mddev,
char *devname = tmpdev->devname;
int dfd;
struct stat stb;
struct supertype *tst = dup_super(st);
struct supertype *tst;
struct dev_policy *pol = NULL;
int found_container = 0;
@ -306,6 +306,8 @@ int Assemble(struct supertype *st, char *mddev,
continue;
}
tst = dup_super(st);
dfd = dev_open(devname, O_RDONLY|O_EXCL);
if (dfd < 0) {
if (report_missmatch)