conf: Fix crash in virDomainDefCompatibleDevice

Commit id 'edae027c' blindly assumed that the passed @oldDev
parameter would not be NULL when calling virDomainDeviceGetInfo;
however, commit id 'b6a264e8' passed NULL for AttachDevice
callers under the premise that there wouldn't be a device
to check/update against.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2018-03-01 07:08:32 -05:00
parent 7a32bedffc
commit 5535856f0e

View File

@ -27417,9 +27417,12 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
{
virDomainCompatibleDeviceData data = {
.newInfo = virDomainDeviceGetInfo(dev),
.oldInfo = virDomainDeviceGetInfo(oldDev),
.oldInfo = NULL,
};
if (oldDev)
data.oldInfo = virDomainDeviceGetInfo(oldDev);
if (!virDomainDefHasUSB(def) &&
def->os.type != VIR_DOMAIN_OSTYPE_EXE &&
virDomainDeviceIsUSB(dev)) {