When validation like deviceValidateCallback fails, the vm will not be
set and so the call to virDomainObjListRemove will be passed a NULL
pointer causing a segfault. To prevent this add a check that the vm is
defined before calling out to virDomainObjListRemove.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: William Douglas <william.douglas@intel.com>
virCHDomainObjEndJob(vm);
cleanup:
- if (!dom) {
+ if (vm && !dom) {
virDomainObjListRemove(driver->domains, vm);
}
virDomainDefFree(vmdef);