This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
Re: The allegation is that setup is keeping open handles around...
- From: Christopher Faylor <cgf-no-personal-reply-please at cygwin dot com>
- To: cygwin-apps at cygwin dot com
- Date: Wed, 17 Nov 2004 00:48:00 -0500
- Subject: Re: The allegation is that setup is keeping open handles around...
- References: <3D848382FB72E249812901444C6BDB1D03E04ED0@exchange.timesys.com>
- Reply-to: cygwin-apps at cygwin dot com
On Wed, Nov 17, 2004 at 12:28:27AM -0500, Robb, Sam wrote:
>>So it looks like the package files aren't being closed somewhere.
>
>Taking a look at the source, and trying to figure out where something
>like this might occur, I ended up in in install.cc, where I saw the
>following comment in Installer::installOneSource():
>
>/* FIXME: potential leak of either *tmp or *tmp2 */
>
>Here, it looks as if handling a compressed file leads to a handle leak
>as an io_stream isn't closed. Actually, there appear to be a couple of
>places where a pointer returned by io_stream::open() isn't being freed
>(where I'm assuming that 'delete tmp' is the proper way to deal with a
>pointer returned by io_stream::open()...)
My investigations brought me to the same place and the same conclusion
although it has been quite a while since I last looked at the setup
sources. It seems likely that you're right, though.
Sort of cries out for some sort of destructor doesn't it? Rather
than
io_stream *tmp = io_stream::open ("foo", "rb");
do
io_stream tmp ("foo", "rb");
and let the io_stream destructor do whatever it has to do.
That is probably a lot of work, though. I guess I don't understand why
there is a FIXME here rather than a delete of tmp and tmp2.
Also I found the use of the variable tmp in different scopes and with
different types seems like a recipe confusing.
If we aren't going to get any traction on this from any of the setup
developers, I'll generate a new version of setup for testing in the
next couple of days.
cgf