]> 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)
committerEric Blake <eblake@redhat.com>
Wed, 30 May 2012 20:22:48 +0000 (14:22 -0600)
virCommandRunAsync() will set errfd if it succeed. We should
close it if virFDStreamOpenInternal() fails.

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;