summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--migration/savevm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/migration/savevm.c b/migration/savevm.c
index 3f611c02e8..68b652ff76 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2284,8 +2284,7 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
f = qemu_fopen_channel_output(QIO_CHANNEL(ioc));
object_unref(OBJECT(ioc));
ret = qemu_save_device_state(f);
- qemu_fclose(f);
- if (ret < 0) {
+ if (ret < 0 || qemu_fclose(f) < 0) {
error_setg(errp, QERR_IO_ERROR);
} else {
/* libxl calls the QMP command "stop" before calling