From 30042f421cc61807fb37135184ee66114df71c1e Mon Sep 17 00:00:00 2001 From: relan Date: Tue, 6 Aug 2013 19:54:09 +0000 Subject: [PATCH] Close device and free super block on failure to read boot sector. --- libexfat/mount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libexfat/mount.c b/libexfat/mount.c index f671686..d10fc98 100644 --- a/libexfat/mount.c +++ b/libexfat/mount.c @@ -189,6 +189,8 @@ int exfat_mount(struct exfat* ef, const char* spec, const char* options) if (exfat_pread(ef->dev, ef->sb, sizeof(struct exfat_super_block), 0) < 0) { + exfat_close(ef->dev); + free(ef->sb); exfat_error("failed to read boot sector"); return -EIO; } -- 2.11.0