qemu: Check if virQEMUCapsNewCopy(...) has failed

Check if virQEMUCapsNewCopy(...) has failed, thus a segmentation fault
in virQEMUCapsFilterByMachineType(...) will be avoided.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
This commit is contained in:
Marc Hartmayer 2017-02-09 15:13:35 +01:00 committed by Laine Stump
parent 728c0e5df4
commit 62b2c2fcdd

View File

@ -4928,6 +4928,10 @@ virQEMUCapsCacheLookupCopy(virCapsPtr caps,
ret = virQEMUCapsNewCopy(qemuCaps);
virObjectUnref(qemuCaps);
if (!ret)
return NULL;
virQEMUCapsFilterByMachineType(ret, machineType);
return ret;
}