]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Fix crash in offline migration
authorJiri Denemark <jdenemar@redhat.com>
Fri, 19 Jan 2018 09:32:44 +0000 (10:32 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Fri, 19 Jan 2018 09:51:19 +0000 (10:51 +0100)
When migrating a shutoff domain (i.e., offline migration), we have no
statistics to report and thus jobInfo will be NULL in
qemuMigrationFinish.

Broken by me in v3.10.0-183-ge8784e7868.

https://bugzilla.redhat.com/show_bug.cgi?id=1536351

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_migration.c

index a56bc596ff51780538eb9870c578db0d5189d7fa..1854900c9a088fcae20e5533c0dc71853b886cd6 100644 (file)
@@ -5481,8 +5481,10 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
     }
 
     if (dom) {
-        VIR_STEAL_PTR(priv->job.completed, jobInfo);
-        priv->job.completed->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
+        if (jobInfo) {
+            VIR_STEAL_PTR(priv->job.completed, jobInfo);
+            priv->job.completed->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
+        }
 
         if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen,
                                     QEMU_MIGRATION_COOKIE_STATS) < 0)