From: John Ferlan Date: Thu, 1 Mar 2018 12:08:32 +0000 (-0500) Subject: conf: Fix crash in virDomainDefCompatibleDevice X-Git-Tag: v4.1.0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5535856f0e31aa6abf4cda11b5c53c0f164680f0;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d96b012b98..fcafc8b2fa 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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)) {