[libvirt] [PATCH] leak of file descriptors in remote code
Daniel Veillard
veillard at redhat.com
Mon Mar 16 17:01:49 UTC 2009
We never deallocate the pipe used to do the wake-up trick, loosing
2 descriptor per connection opened in a process,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
-------------- next part --------------
Index: src/remote_internal.c
===================================================================
RCS file: /data/cvs/libxen/src/remote_internal.c,v
retrieving revision 1.141
diff -u -u -p -r1.141 remote_internal.c
--- src/remote_internal.c 3 Mar 2009 19:33:34 -0000 1.141
+++ src/remote_internal.c 16 Mar 2009 16:57:17 -0000
@@ -332,7 +332,7 @@ doRemoteOpen (virConnectPtr conn,
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
int flags)
{
- int wakeupFD[2];
+ int wakeupFD[2] = { -1, -1 };
char *transport_str = NULL;
if (conn->uri) {
@@ -885,6 +885,11 @@ doRemoteOpen (virConnectPtr conn,
#endif
}
+ if (wakeupFD[0] >= 0) {
+ close(wakeupFD[0]);
+ close(wakeupFD[1]);
+ }
+
VIR_FREE(priv->hostname);
goto cleanup;
}
@@ -1350,6 +1355,11 @@ doRemoteClose (virConnectPtr conn, struc
} while (reap != -1 && reap != priv->pid);
}
#endif
+ if (priv->wakeupReadFD >= 0) {
+ close(priv->wakeupReadFD);
+ close(priv->wakeupSendFD);
+ }
+
/* Free hostname copy */
free (priv->hostname);
More information about the libvir-list
mailing list