[PATCH 08/19] Assemble(): don't dup_super() before we need it.
From: <hidden>
Date: 2011-11-01 15:09:24
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: <hidden>
Date: 2011-11-01 15:09:24
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Jes Sorensen <redacted> Avoid resource leak in case we bail loop early Signed-off-by: Jes Sorensen <redacted> --- Assemble.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index 05710f5..3c8e74d 100644
--- a/Assemble.c
+++ b/Assemble.c@@ -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)
--
1.7.6.4