qemu: avoid null deref on low memory

Detected by Coverity.  qemuDomainEventQueue requires a non-NULL
pointer; most callers silently drop the event if we encountered
and OOM situation trying to create the event.

* src/qemu/qemu_migration.c (qemuMigrationFinish): Check for OOM.
This commit is contained in:
Eric Blake 2011-07-04 10:30:43 +08:00 committed by Daniel Veillard
parent 3f81f8e4c1
commit 74d224fac3

View File

@ -2552,7 +2552,8 @@ qemuMigrationFinish(struct qemud_driver *driver,
VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
qemuDomainEventQueue(driver, event);
if (event)
qemuDomainEventQueue(driver, event);
event = virDomainEventNewFromObj(vm,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);