This is the mail archive of the
mailing list for the Cygwin project.
Re: cygwin 1.3.17-1 gethostbyname() leak
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: "Pierre A. Humblet" <pierre dot humblet at ieee dot org>
- Cc: cygwin at cygwin dot com
- Date: Tue, 10 Dec 2002 14:45:52 -0500 (EST)
- Subject: Re: cygwin 1.3.17-1 gethostbyname() leak
- Reply-to: cygwin at cygwin dot com
Corinna's earlier post indicated that using this pointer collided with
Cygwin's fork/exec mechanism...
On Tue, 10 Dec 2002, Pierre A. Humblet wrote:
> On Wed, Dec 11, 2002 at 06:12:21AM +1100, Noel Gordon wrote:
> > If it is true that cygwin uses gethostbyname() from wsock32.dll, and
> > returns the wsock32.dll hostent* result to the application, then it
> > is perhaps unwise to free() it. Following your tip, we find from ...
> In net.cc cygwin takes the result from the MS GetHostByName and copies
> it to its own calloc'ed structure.
> Not sure why, given that the MS function already returns a pointer to
> a per thread structure, as indicated below.
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/gethostby
> > name_2.asp
> > Remarks
> > The gethostbyname function returns a pointer to a hostent structure - a
> > structure allocated by Windows Sockets. The hostent structure contains
> > the results of a successful search for the host specified in the name
> > parameter [of gethostbyname()].
> > The application must never attempt to modify this structure or to free
> > any of its components. Furthermore, only one copy of this structure is
> > allocated per thread, so the application should copy any information it
> > needs before issuing any other Windows Sockets function calls.
|\ _,,,---,,_ firstname.lastname@example.org
ZZZzz /,`.-'`' -. ;-;;,_ email@example.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html