提交 9684bb11 编写于 作者: V Viktor Mihajlovski 提交者: Jiri Denemark

qemu: Fix crash in migration of graphics-less guests.

Commit 7f15ebc7 introduced a bug
happening when guests without a <graphics> 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: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
上级 e13e548f
...@@ -1723,7 +1723,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver, ...@@ -1723,7 +1723,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
int ret; int ret;
char *listenAddress = cookie->graphics->listen; char *listenAddress;
if (!cookie) if (!cookie)
return 0; return 0;
...@@ -1737,6 +1737,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver, ...@@ -1737,6 +1737,7 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
if (cookie->graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) if (cookie->graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
return 0; return 0;
listenAddress = cookie->graphics->listen;
if (!listenAddress || if (!listenAddress ||
STREQ(listenAddress, "0.0.0.0") || STREQ(listenAddress, "0.0.0.0") ||
STREQ(listenAddress, "::")) STREQ(listenAddress, "::"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册