[PATCH] virFDStream: close also given errfd (fd leak)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In virFDStreamOpenFileInternal(), a errfd pipe is opened by
virCommandRunAsync() and given to virFDStreamOpenInternal().

It seems virFDStream should close errfd, just like the other
fd it is given.

This fixes screenshots leaking FDs:
http://bugzilla.redhat.com/show_bug.cgi?id=745761
---
 src/fdstream.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/fdstream.c b/src/fdstream.c
index b60162c..841f979 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -268,6 +268,10 @@ virFDStreamClose(virStreamPtr st)
         virCommandFree(fdst->cmd);
         fdst->cmd = NULL;
     }
+
+    if (VIR_CLOSE(fdst->errfd) < 0)
+        VIR_DEBUG("ignoring failed close on fd %d", fdst->errfd);
+
     st->privateData = NULL;
 
     if (fdst->dispatching) {
-- 
1.7.6.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]