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:
parent
730ae51fdd
commit
518a60f385
|
@ -293,7 +293,7 @@ int Assemble(struct supertype *st, char *mddev,
|
||||||
char *devname = tmpdev->devname;
|
char *devname = tmpdev->devname;
|
||||||
int dfd;
|
int dfd;
|
||||||
struct stat stb;
|
struct stat stb;
|
||||||
struct supertype *tst = dup_super(st);
|
struct supertype *tst;
|
||||||
struct dev_policy *pol = NULL;
|
struct dev_policy *pol = NULL;
|
||||||
int found_container = 0;
|
int found_container = 0;
|
||||||
|
|
||||||
|
@ -306,6 +306,8 @@ int Assemble(struct supertype *st, char *mddev,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tst = dup_super(st);
|
||||||
|
|
||||||
dfd = dev_open(devname, O_RDONLY|O_EXCL);
|
dfd = dev_open(devname, O_RDONLY|O_EXCL);
|
||||||
if (dfd < 0) {
|
if (dfd < 0) {
|
||||||
if (report_missmatch)
|
if (report_missmatch)
|
||||||
|
|
Loading…
Reference in New Issue