aboutsummaryrefslogtreecommitdiff
path: root/qemu-io-cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-io-cmds.c')
-rw-r--r--qemu-io-cmds.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index d46fa166d3..349256a5fe 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -401,6 +401,7 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len,
}
fclose(f);
+ f = NULL;
if (len > pattern_len) {
len -= pattern_len;
@@ -420,6 +421,9 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len,
error:
qemu_io_free(buf_origin);
+ if (f) {
+ fclose(f);
+ }
return NULL;
}