From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx> Avoid resource leak in case we bail loop early Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html