]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
avoid fd leak
authorWen Congyang <wency@cn.fujitsu.com>
Wed, 30 May 2012 09:20:46 +0000 (17:20 +0800)
committerCole Robinson <crobinso@redhat.com>
Thu, 14 Jun 2012 22:23:21 +0000 (18:23 -0400)
virCommandRunAsync() will set errfd if it succeed. We should
close it if virFDStreamOpenInternal() fails.
(cherry picked from commit 655cffa0f25be40c68624036af80bde102177612)

src/fdstream.c

index 32d386dce6d9d24a22b390e19bd89f44cb3a095e..fca0f412d63250e406ea55f18624a5ebb9997189 100644 (file)
@@ -668,6 +668,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;