From 3a47e083b2e118cb338442721a73ed8506e4c0ed Mon Sep 17 00:00:00 2001 Message-Id: <3a47e083b2e118cb338442721a73ed8506e4c0ed@dist-git> From: Jiri Denemark Date: Fri, 19 Jan 2018 10:32:44 +0100 Subject: [PATCH] qemu: Fix crash in offline migration 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 Reviewed-by: Pavel Hrdina (cherry picked from commit bcc5710708ec90146b71bdb00d8705cb4a9e0088) https://bugzilla.redhat.com/show_bug.cgi?id=1530130 Signed-off-by: Jiri Denemark --- src/qemu/qemu_migration.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 120b79415e..2b1e8dd9fd 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -5372,8 +5372,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) -- 2.16.0