From: John Ferlan Date: Tue, 1 Sep 2015 10:47:55 +0000 (-0400) Subject: qemu: Check virGetLastError return value for migration finish failure X-Git-Tag: v1.2.20-rc1~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea3c5f25eb94f08d2a54385362c7ad60c6b1854e;p=thirdparty%2Flibvirt.git qemu: Check virGetLastError return value for migration finish failure 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. --- diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index cbf08fc8c8..964a4d7806 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -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; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index ff89ab5f1e..d50d3675d7 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -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;