From dc200aa851806e89cd7d580880afebf9e3663b25 Mon Sep 17 00:00:00 2001 From: Viktor Mihajlovski Date: Thu, 16 May 2013 14:41:29 +0200 Subject: [PATCH] qemu: Fix crash in migration of graphics-less guests. Commit 7f15ebc7a2b599ab10dbc15bca6f823591213e67 introduced a bug happening when guests without a element are migrated. The initialization of listenAddress happens unconditionally from the cookie even if the cookie->graphics pointer was NULL. Moved the initialization to where it is safe. Signed-off-by: Viktor Mihajlovski (cherry picked from commit 9684bb11fd3832582308d0bcdb649041fd6584e2) --- src/qemu/qemu_migration.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index f602b2a07c..d96805a476 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1742,7 +1742,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver, { qemuDomainObjPrivatePtr priv = vm->privateData; int ret; - char *listenAddress = cookie->graphics->listen; + char *listenAddress; if (!cookie) return 0; @@ -1756,6 +1756,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver, if (cookie->graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) return 0; + listenAddress = cookie->graphics->listen; if (!listenAddress || STREQ(listenAddress, "0.0.0.0") || STREQ(listenAddress, "::"))