Signed-off-by: Prerna Saxena <saxenap.ltc(a)gmail.com>
---
src/qemu/qemu_driver.c | 20 ++++++++++++++++++++
src/qemu/qemu_event.c | 2 ++
2 files changed, 22 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 881f253..e4b6d06 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1781,6 +1781,11 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr conn,
VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
NULL)))
goto cleanup;
+
+ if (virQemuVmEventListInit(vm) < 0) {
+ virDomainObjListRemove(driver->domains, vm);
+ goto cleanup;
+ }
virObjectRef(vm);
def = NULL;
@@ -5531,6 +5536,11 @@ qemuDomainRestoreFlags(virConnectPtr conn,
VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
NULL)))
goto cleanup;
+
+ if (virQemuVmEventListInit(vm) < 0) {
+ virDomainObjListRemove(driver->domains, vm);
+ goto cleanup;
+ }
virObjectRef(vm);
def = NULL;
@@ -6208,6 +6218,11 @@ qemuDomainDefineXMLFlags(virConnectPtr conn,
0, &oldDef)))
goto cleanup;
+ if (virQemuVmEventListInit(vm) < 0) {
+ virDomainObjListRemove(driver->domains, vm);
+ goto cleanup;
+ }
+
virObjectRef(vm);
def = NULL;
if (qemuDomainHasBlockjob(vm, true)) {
@@ -15073,6 +15088,11 @@ static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn,
NULL)))
goto cleanup;
+ if (virQemuVmEventListInit(vm) < 0) {
+ virDomainObjListRemove(driver->domains, vm);
+ goto cleanup;
+ }
+
virObjectRef(vm);
def = NULL;
diff --git a/src/qemu/qemu_event.c b/src/qemu/qemu_event.c
index beb309f..00a06ee 100644
--- a/src/qemu/qemu_event.c
+++ b/src/qemu/qemu_event.c
@@ -145,6 +145,8 @@ int virEnqueueVMEvent(virQemuEventList *qlist, qemuEventPtr ev)
/* Insert into per-Vm queue */
vmq = ev->vm->vmq;
+ if (!vmq)
+ goto error;
virMutexLock(&(vmq->lock));
if (vmq->last) {
--
2.9.5