Re: memory leak on dns failure?

Ming Fu <[email protected]>
Newsgroups gmane.comp.web.polipo.user
Message-ID <[email protected]>
Hi Juliusz,

httpWriteErrorHeaders() is called from a number of locations. In a few
cases, the message is allocated at the parameters to the call, so the caller
do not actually have a way to release the reference to the atom. e.g. in
tunnel.c

        tunnelError(tunnel, 400, internAtom(gettext("Couldn't parse
CONNECT")));

then in tunnelError(),
        n = httpWriteErrorHeaders(tunnel->buf2.buf, CHUNK_SIZE - 1, 0,
                              1, code, message, 1, NULL,
                              NULL, 0, NULL);
Also in client.c
                return httpClientRawErrorHeaders(connection,
                        request->error_code,
                        retainAtom(request->
                            error_message),
                        1, request->error_headers);

All seem to expect the called function to release the reference after use.

Regards,
Ming


On Mon, Apr 27, 2009 at 4:09 PM, Juliusz Chroboczek <
[email protected]> wrote:

> > Does this sound reasonable?
>
> Hmm, looks dodgy to me.  Message is allocated by the caller, hence it is
> the caller's responsibility to get rid of it, both in the failure and
> the success cases.
>
> I'll look into it.
>
>                                        Juliusz
>
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.