Re: TServerSocket memory leak

Fons Rademakers ((no email))
Tue, 23 Dec 1997 11:15:38 +0100 (MET)


Hi William,

thanks for reporting this bug. I've fixed it in the development
version.

Cheers, Fons.

>
> Hello,
>
> The TServerSocket::Accept() seems to be missing a TSocket delete in the
> event that a socket connection isn't waiting. When the
> TServerSocket::SetOption( kNoBlock,1), is used and Accept is placed in a
> working loop, system memory vanishes rather quickly.
>
>
> TSocket *TServerSocket::Accept()
> {
> TSocket *socket = new TSocket;
> Int_t soc = gSystem->AcceptConnection(fSocket);
> if (soc == -1) return 0;
> if (soc == -2) return (TSocket*) -1;
>
> etc...
> }
>
> I think it needs the following:
>
> TSocket *TServerSocket::Accept()
> {
> TSocket *socket = new TSocket;
> Int_t soc = gSystem->AcceptConnection(fSocket);
>
> if (soc == -1)
> {
> delete socket;
> return 0;
> }
> if (soc == -2)
> {
> delete socket;
> return (TSocket*) -1;
> }
>
> ...etc
> }
>
> William Deninger
> deninger@uiuc.edu
>
>
>
>

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910