diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 91e234d64448fbe3fde6f0798cac66c69b82d9ec..98ffd23a71b222f6e740207910533b6e1c1f3ffd 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4973,6 +4973,14 @@ qemuDomainDefPostParse(virDomainDefPtr def, if (!def->os.machine) { const char *machine = virQEMUCapsGetPreferredMachine(qemuCaps, def->virtType); + if (!machine) { + virReportError(VIR_ERR_INVALID_ARG, + _("could not get preferred machine for %s type=%s"), + def->emulator, + virDomainVirtTypeToString(def->virtType)); + return -1; + } + def->os.machine = g_strdup(machine); }