]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Check virGetLastError return value for migration finish failure
authorJohn Ferlan <jferlan@redhat.com>
Tue, 1 Sep 2015 10:47:55 +0000 (06:47 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 4 Sep 2015 19:19:04 +0000 (15:19 -0400)
Commit id '2e7cea243' added a check for an error from Finish instead
of 'unexpected error'; however, if for some reason there wasn't an
error, then virGetLastError could return NULL resulting in the
NULL pointer deref to err->domain.

src/libvirt-domain.c
src/qemu/qemu_migration.c

index cbf08fc8c8027a8f1fe6c1d0ff39b0d6f5d07f08..964a4d7806ba2fab32f8ed04bb1c8e6ebe221679 100644 (file)
@@ -3195,7 +3195,8 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
                 orig_err->domain == VIR_FROM_QEMU &&
                 orig_err->code == VIR_ERR_OPERATION_FAILED) {
                 virErrorPtr err = virGetLastError();
-                if (err->domain == VIR_FROM_QEMU &&
+                if (err &&
+                    err->domain == VIR_FROM_QEMU &&
                     err->code != VIR_ERR_MIGRATE_FINISH_OK) {
                     virFreeError(orig_err);
                     orig_err = NULL;
index ff89ab5f1e77907ee70709f0cce90e10712ecc38..d50d3675d7afb41e75fadab9655bec3484079b01 100644 (file)
@@ -5023,7 +5023,8 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
                 orig_err->domain == VIR_FROM_QEMU &&
                 orig_err->code == VIR_ERR_OPERATION_FAILED) {
                 virErrorPtr err = virGetLastError();
-                if (err->domain == VIR_FROM_QEMU &&
+                if (err &&
+                    err->domain == VIR_FROM_QEMU &&
                     err->code != VIR_ERR_MIGRATE_FINISH_OK) {
                     virFreeError(orig_err);
                     orig_err = NULL;