mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-04 02:45:22 +00:00
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 <mkletzan@redhat.com> (cherry picked from commit b3ea0a8fb86a8024538c68ca1d43a2bbc0192a0f)
This commit is contained in:
parent
67ca910eec
commit
5b3d68730d
@ -15498,7 +15498,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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user