mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 12:05:17 +00:00
domain_conf: fix possible memory leak
Until now, it was possible to crash libvirtd when defining domain with channel device with missing source element. When creating new virDomainChrDef, target.port is set to -1, but unfortunately it is an union with addresses that virDomainChrDefFree tries to free in case the deviceType is channel. Having the port set to -1 is intended, however the cleanest way to get around the problems with the crash seems to be renumbering the VIR_DOMAIN_CHR_CHANNEL_ target types to cover new NONE type (with value 0) being the default (no target type yet). (cherry picked from commit 830d035ff5a88c3896a6e508364e34697de941a1)
This commit is contained in:
parent
855d8612a2
commit
49cb53fae9
@ -307,6 +307,7 @@ VIR_ENUM_IMPL(virDomainNetInterfaceLinkState, VIR_DOMAIN_NET_INTERFACE_LINK_STAT
|
|||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainChrChannelTarget,
|
VIR_ENUM_IMPL(virDomainChrChannelTarget,
|
||||||
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
|
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
|
||||||
|
"none",
|
||||||
"guestfwd",
|
"guestfwd",
|
||||||
"virtio")
|
"virtio")
|
||||||
|
|
||||||
|
@ -846,7 +846,8 @@ enum virDomainChrDeviceType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum virDomainChrChannelTargetType {
|
enum virDomainChrChannelTargetType {
|
||||||
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD = 0,
|
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_NONE = 0,
|
||||||
|
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD,
|
||||||
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,
|
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO,
|
||||||
|
|
||||||
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
|
VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_LAST,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user