summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2009-11-30 18:21:19 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 10:48:51 -0600
commit5d39c799c3245244ebb1e89da0177dbc089962b2 (patch)
treef32bb9adbf487d9a2213b4e0f632cd411777ec3a /migration.c
parentsavevm: Port to qdev.vmsd all devices that have qdev (diff)
downloadqemu-kvm-5d39c799c3245244ebb1e89da0177dbc089962b2.tar.gz
qemu-kvm-5d39c799c3245244ebb1e89da0177dbc089962b2.tar.bz2
qemu-kvm-5d39c799c3245244ebb1e89da0177dbc089962b2.zip
migration: Fix use of file after release
qemu_fclose frees the passed file structure, but do_migrate_set_speed may access it later on. Fix it by setting file NULL in migrate_fd_cleanup and checking for this. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/migration.c b/migration.c
index 3ae0be86c..dcde7c38d 100644
--- a/migration.c
+++ b/migration.c
@@ -118,12 +118,11 @@ void do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data)
}
max_throttle = (uint32_t)d;
- s = migrate_to_fms(current_migration);
- if (s) {
+ s = migrate_to_fms(current_migration);
+ if (s && s->file) {
qemu_file_set_rate_limit(s->file, max_throttle);
}
-
}
/* amount of nanoseconds we are willing to wait for migration to be down.
@@ -209,6 +208,7 @@ void migrate_fd_cleanup(FdMigrationState *s)
if (s->file) {
dprintf("closing file\n");
qemu_fclose(s->file);
+ s->file = NULL;
}
if (s->fd != -1)