]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainSnapshotPrepare: Don't always assume vm->def->os.loader
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 30 Mar 2017 12:03:45 +0000 (14:03 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 30 Mar 2017 12:03:45 +0000 (14:03 +0200)
In 9e2465834 a check that denies internal snapshots when pflash
based loader is configured for the domain. However, if there's
none and an user tries to do an internal snapshot they will
witness daemon crash as in that case vm->def->os.loader is NULL
and we dereference it unconditionally.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_driver.c

index 40c2eabad1847666aa32ba99117cde38614df44d..3cc4f4d66987177f3408ebe89560ba3a2e7c08cf 100644 (file)
@@ -13889,6 +13889,7 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
      * Avoid the issues by forbidding internal snapshot with pflash completely.
      */
     if (found_internal &&
+        vm->def->os.loader &&
         vm->def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("internal snapshots of a VM with pflash based "