aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 d46fa16..349256a 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;
}