提交 b3ea0a8f 编写于 作者: M Martin Kletzander

qemu: Don't crash in qemuDomainOpenChannel()

The problem here was that when opening a channel, we were checking
whether the channel given is alias (can't be NULL for running domain) or
it's name, which can be NULL (for example with spicevmc).  In case of
such domain qemuDomainOpenChannel() made the daemon crash.
STREQ_NULLABLE() is safe to use since the code in question is wrapped in
"if (name)" and is more readable, so use that instead of checking for
non-NULL "vm->def->channels[i]->target.name".
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 567bd0fa
......@@ -15460,7 +15460,7 @@ qemuDomainOpenChannel(virDomainPtr dom,
if (vm->def->channels[i]->targetType == \
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
STREQ(name, vm->def->channels[i]->target.name))
STREQ_NULLABLE(name, vm->def->channels[i]->target.name))
chr = vm->def->channels[i];
}
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册