virCPUDefPtr origCPU = NULL;
unsigned int start_flags = VIR_QEMU_PROCESS_START_GEN_VMID;
qemuDomainAsyncJob jobType = QEMU_ASYNC_JOB_START;
+ bool defined = false;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED |
virDomainObjAssignDef(vm, config, false, NULL);
virCPUDefFree(priv->origCPU);
VIR_STEAL_PTR(priv->origCPU, origCPU);
+ config = NULL;
+ defined = true;
}
if (cookie && !cookie->slirpHelper)
/* Transitions 2, 3 */
load:
was_stopped = true;
- if (config)
+ if (config) {
virDomainObjAssignDef(vm, config, false, NULL);
+ config = NULL;
+ defined = true;
+ }
/* No cookie means libvirt which saved the domain was too old to
* mess up the CPU definitions.
qemuProcessEndJob(driver, vm);
goto cleanup;
}
- if (config)
+ if (config) {
virDomainObjAssignDef(vm, config, false, NULL);
+ config = NULL;
+ defined = true;
+ }
if (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING |
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) {
ret = -1;
}
}
- if (ret == 0 && config && vm->persistent &&
+ if (ret == 0 && defined && vm->persistent &&
!(ret = virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef ? vm->newDef : vm->def))) {
detail = VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT;
virObjectUnref(cfg);
virNWFilterUnlockFilterUpdates();
virCPUDefFree(origCPU);
+ virDomainDefFree(config);
return ret;
}