From b3ea0a8fb86a8024538c68ca1d43a2bbc0192a0f Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Mon, 2 Mar 2015 15:42:41 +0100 Subject: [PATCH] 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: Martin Kletzander --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e59f501c6d..da22f2bab7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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 {