[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu: avoid dereferencing a NULL pointer



From: Alex Jia <ajia redhat com>

* src/qemu/qemu_migration.c: avoid dereferencing a pointer that might be 
  null "vmdef" when calling virDomainSaveConfig.

Signed-off-by: Alex Jia <ajia redhat com>
---
 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
                  * was not.  If we report successful, then when this domain
-- 
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]