On 09/16/2011 10:17 AM, ajia@xxxxxxxxxx wrote:
From: Alex Jia<ajia@xxxxxxxxxx> * src/qemu/qemu_migration.c: avoid dereferencing a pointer that might be null "vmdef" when calling virDomainSaveConfig.
Thanks for catching this.
Signed-off-by: Alex Jia<ajia@xxxxxxxxxx> --- src/qemu/qemu_migration.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index d9f8d93..69ced88 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2510,7 +2510,8 @@ qemuMigrationFinish(struct qemud_driver *driver, if (vm->persistent) newVM = 0; vm->persistent = 1; - vmdef = virDomainObjGetPersistentDef(driver->caps, vm); + if (!(vmdef = virDomainObjGetPersistentDef(driver->caps, vm))) + goto endjob; if (virDomainSaveConfig(driver->configDir, vmdef)< 0) { /* Hmpf. Migration was successful, but making it persistent
But your fix is not quite right. I think we need something like: if (!(vmdef = virDomainObjGetPersistentDef(driver->caps, vm)) || virDomainSaveConfig(driver->configDir, vmdef) < 0) { /* Hmpf. ... */ I'll let Dan weigh in on it, too. -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list