[libvirt] [PATCH] leak of file descriptors in remote code
Daniel P. Berrange
berrange at redhat.com
Tue Mar 17 10:35:39 UTC 2009
On Mon, Mar 16, 2009 at 06:01:49PM +0100, Daniel Veillard wrote:
> We never deallocate the pipe used to do the wake-up trick, loosing
> 2 descriptor per connection opened in a process,
ACK, but you've got some whitespace problems in the patch that will
break 'make syntax-check'.
> 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);
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list