summaryrefslogtreecommitdiff
path: root/convert.c
diff options
context:
space:
mode:
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/convert.c b/convert.c
index 2b3f42f2..4a758958 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;
}