openvz: Need to check 'vm' first before dereferencing 'def'

This commit is contained in:
John Ferlan 2013-01-15 13:35:38 -05:00 committed by Peter Krempa
parent 3f9d6c3566
commit a75d762fcd

View File

@ -2053,13 +2053,13 @@ openvzDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml,
openvzDriverLock(driver); openvzDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
vmdef = vm->def;
if (!vm) { if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
vmdef = vm->def;
if (virStrToLong_i(vmdef->name, NULL, 10, &veid) < 0) { if (virStrToLong_i(vmdef->name, NULL, 10, &veid) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",