stops an fd leak that Coverity found.

Signed-off-by: Eric Sandeen <sand...@redhat.com>
---
 convert.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/convert.c b/convert.c
index 2b3f42f..4a75895 100644
--- a/convert.c
+++ b/convert.c
@@ -2277,7 +2277,8 @@ err:
 
 int do_convert(const char *devname, int datacsum, int packing, int noxattr)
 {
-       int i, fd, ret;
+       int i, ret;
+       int fd = -1;
        u32 blocksize;
        u64 blocks[7];
        u64 total_bytes;
@@ -2407,6 +2408,8 @@ int do_convert(const char *devname, int datacsum, int 
packing, int noxattr)
        printf("conversion complete.\n");
        return 0;
 fail:
+       if (fd != -1)
+               close(fd);
        fprintf(stderr, "conversion aborted.\n");
        return -1;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to