]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainSnapshotCreateXML: avoid NULL dereferences
authorJim Meyering <meyering@redhat.com>
Tue, 27 Apr 2010 20:35:32 +0000 (22:35 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 29 Apr 2010 09:16:04 +0000 (11:16 +0200)
* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): When setting
"vm" to NULL, jump over vm-dereferencing code to "cleanup".
(qemuDomainRevertToSnapshot): Likewise.

src/qemu/qemu_driver.c

index cbd6b67c5e43d42f4914f8dda9c5905d93edb1af..dbc6e2d4b46648896a521154eb471178af739a61 100644 (file)
@@ -10875,8 +10875,10 @@ static virDomainSnapshotPtr qemuDomainSnapshotCreateXML(virDomainPtr domain,
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
         ret = qemuMonitorCreateSnapshot(priv->mon, def->name);
         qemuDomainObjExitMonitorWithDriver(driver, vm);
-        if (qemuDomainObjEndJob(vm) == 0)
+        if (qemuDomainObjEndJob(vm) == 0) {
             vm = NULL;
+            goto cleanup;
+        }
         if (ret < 0)
             goto cleanup;
     }
@@ -11205,6 +11207,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
                 if (qemuDomainObjEndJob(vm) > 0)
                     virDomainRemoveInactive(&driver->domains, vm);
                 vm = NULL;
+                goto cleanup;
             }
         }