From: Cédric Bosdonnat Date: Tue, 6 Dec 2016 13:20:13 +0000 (+0100) Subject: lxc: monitor now holds a reference to the domain X-Git-Tag: v3.0.0-rc1~365 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cd556d486c1abd347333de420975f4b6a80c2bb;p=thirdparty%2Flibvirt.git 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. --- diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c index d828d528a6..9cab6c2035 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); }