If the monitor doesn't hold a reference to the domain object
the object may be destroyed before the monitor actually stops.
---
src/lxc/lxc_monitor.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index d828d52..de63f9e 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -179,6 +179,7 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm,
memcpy(&mon->cb, cb, sizeof(mon->cb));
virObjectRef(mon);
+ virObjectRef(vm);
virNetClientSetCloseCallback(mon->client, virLXCMonitorEOFNotify, mon,
virLXCMonitorCloseFreeCallback);
@@ -188,6 +189,7 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm,
error:
virObjectUnref(mon);
+ virObjectUnref(vm);
mon = NULL;
goto cleanup;
}
@@ -201,6 +203,7 @@ static void virLXCMonitorDispose(void *opaque)
if (mon->cb.destroy)
(mon->cb.destroy)(mon, mon->vm);
virObjectUnref(mon->program);
+ virObjectUnref(mon->vm);
}
--
2.10.2