]> xenbits.xensource.com Git - libvirt.git/commit
libxl: fix leaking libxlDomainObjPrivate
authorJim Fehlig <jfehlig@suse.com>
Fri, 31 Jan 2014 23:57:09 +0000 (16:57 -0700)
committerJim Fehlig <jfehlig@suse.com>
Thu, 6 Feb 2014 17:06:26 +0000 (10:06 -0700)
commitcda52dbfe51fa5307b8b1fc419e1dd2fac1596a1
tree9841c997d425e0bfa479a7edf42196b24c2d75b5
parent0778fc1ab9c39bb989d168ec44a980c3db943fca
libxl: fix leaking libxlDomainObjPrivate

When libxl registers an FD with the libxl driver, the refcnt of the
associated libxlDomainObjPrivate object is incremented. The refcnt
is decremented when libxl deregisters the FD.  But some FDs are only
deregistered when their libxl ctx is freed, which unfortunately is
done in the libxlDomainObjPrivate dispose function.  With references
held by the FDs, libxlDomainObjPrivate is never disposed.

I added the ref/unref in FD registration/deregistration when adding
the same in timer registration/deregistration.  For timers, this
is a simple approach to ensuring the libxlDomainObjPrivate is not
disposed prior to their expirtation, which libxl guarantees will
occur.  It is not needed for FDs, and only causes
libxlDomainObjPrivate to leak.

This patch removes the reference on libxlDomainObjPrivate for FD
registrations, but retains them for timer registrations.  Tested on
the latest releases of Xen supported by the libxl driver:  4.2.3,
4.3.1, and 4.4.0 RC3.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/libxl/libxl_domain.c