W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2000

Memory Leak In HTReqMant.c

From: Mike Tardif <mtardif@JetForm.com>
Date: Thu, 20 Jul 2000 09:58:46 -0400
Message-ID: <111CF63B7D2ED211830000805F65A2FFC01BA3@OTTMAIL2>
To: "'www-lib@w3.org'" <www-lib@w3.org>
Users of HTPutDocumentAnchor() will notice a memory leak in the function
HTRequest_setOutputStream().

HTPutDocumentAnchor() internally does two calls to
HTRequest_setOutputStream(),
and in the process, looses a reference to a calloc'ed pointer, stored in
	me->output_stream
I don't really know whose responsibility it is to free up this, but I can
cure
the symptom with the following change in  HTRequest_setOutputStream():

% diff /libwww/library/src/HTReqman.c HTReqman.c
1104a1105,1112
>       /*
>       ** Maybe this is just curing the symptoms, but output_stream
>       ** may be pointing to calloc'ed data, so free things before
>       ** resetting it.
>       ** Mike P. Tardif, Jetform Corp [mailto:mike.tardif@jetform.com].
>       */
>       if (me->output_stream)
>           HTNoFreeStream_delete(me->output_stream);

Cheers, 
Mike P. Tardif         "Windows is about as stable 
JetForm Corporation     as a double-decker bus caught
Ottawa, ON K1Z 8R7      in the middle of hurricane 
Vox: +1(613)230-3676    Floyd." -- The Economist
mailto:mtardif@jetform.com  
 .
Received on Thursday, 20 July 2000 10:02:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:37 GMT