File 089d7a55-lxc-monitor-now-holds-a-reference-to-the-domain.patch of Package libvirt.11509
From 6fe73b26f8909e7f508a8521b10e625463a1b488 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
Date: Tue, 6 Dec 2016 14:20:13 +0100
Subject: [PATCH] lxc: monitor now holds a reference to the domain
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, 2 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index d828d528a..9cab6c203 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -175,7 +175,7 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm,
mon->program) < 0)
goto error;
- mon->vm = vm;
+ mon->vm = virObjectRef(vm);
memcpy(&mon->cb, cb, sizeof(mon->cb));
virObjectRef(mon);
@@ -201,6 +201,7 @@ static void virLXCMonitorDispose(void *opaque)
if (mon->cb.destroy)
(mon->cb.destroy)(mon, mon->vm);
virObjectUnref(mon->program);
+ virObjectUnref(mon->vm);
}
--
2.11.0