[PATCH 3/3] avoid fd leak

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

 



virCommandRunAsync() will set errfd if it successes. We should
close it if virFDStreamOpenInternal() fails.

---
 src/fdstream.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/fdstream.c b/src/fdstream.c
index d0ea0ee..f068439 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -673,6 +673,7 @@ error:
     VIR_FORCE_CLOSE(fds[0]);
     VIR_FORCE_CLOSE(fds[1]);
     VIR_FORCE_CLOSE(fd);
+    VIR_FORCE_CLOSE(errfd);
     if (oflags & O_CREAT)
         unlink(path);
     return -1;
-- 
1.7.1

--
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]