]> xenbits.xensource.com Git - libvirt.git/commit
libxl: fix leaking logfile fds
authorJim Fehlig <jfehlig@suse.com>
Thu, 31 May 2018 21:41:37 +0000 (15:41 -0600)
committerJim Fehlig <jfehlig@suse.com>
Mon, 4 Jun 2018 22:07:39 +0000 (16:07 -0600)
commit67c56f6e65b9cd2681ef1bc61d8b51cbc543fa42
treedab994761e41783cd7b75c34aeb64e32eb62ae7e
parenta1b43af0ba0d2b56e24ed6d291f6b3f5dde4ccd9
libxl: fix leaking logfile fds

Per-domain log files were introduced in commit a30b08b7179. The FILE
objects associated with these log files are stored in a hash table
using domid as a key. When a domain is shutdown, destroyed, or
otherwise powered-off, the FILE object is removed from the hash table,
where the free function will close the FILE.

Unfortunately the call to remove the FILE from the hash table occurs
after setting domid=-1 in the libxlDomainCleanup() function. The
object is never removed from the hash table, the free function is
never called, and the underlying fd is leaked. Fix by removing the
FILE object from the hash table before setting domid=-1.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libxl/libxl_domain.c