diff mbox series

[2/2] migration: cleanup in error paths in loadvm

Message ID 20180914170430.54271-3-dgilbert@redhat.com
State New
Headers show
Series migration cleanup fixes | expand

Commit Message

Dr. David Alan Gilbert Sept. 14, 2018, 5:04 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

There's a couple of error paths in qemu_loadvm_state
which happen early on but after we've initialised the
load state; that needs to be cleaned up otherwise
we can hit asserts if the state gets reinitialised later.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/savevm.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/migration/savevm.c b/migration/savevm.c
index 6384cf676d..534f7daf31 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2331,11 +2331,13 @@  int qemu_loadvm_state(QEMUFile *f)
     if (migrate_get_current()->send_configuration) {
         if (qemu_get_byte(f) != QEMU_VM_CONFIGURATION) {
             error_report("Configuration section missing");
+            qemu_loadvm_state_cleanup();
             return -EINVAL;
         }
         ret = vmstate_load_state(f, &vmstate_configuration, &savevm_state, 0);
 
         if (ret) {
+            qemu_loadvm_state_cleanup();
             return ret;
         }
     }