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

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



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


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