W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1998

Patch for leaking HTStreamStacks for review

From: Mike Bennett <mbennett@netcom.com>
Date: Thu, 15 Oct 1998 10:02:08 -0700 (PDT)
Message-Id: <199810151702.KAA00603@netcom2.netcom.com>
To: www-lib@w3.org
Cc: mbennett@netcom2.netcom.com (Mike Bennett)
Hello fellow libwww-ers:

Here's a patch to HTTP.c to fix a memory leak that occurs during 
a pipeline recovery situation.  It works for me, but, of course,
your mileage may vary.

Thanks-
  -mike bennett (mbennett@netcom.com)
-------------------------------------

# NOTES - this is to fix a leak in the situation where a HT_RECOVER_PIPE
# situation occurs; the HTStreamStack used as the read stream for a
# HTNet object was being overwritten and subsequently lost
#
# The result of 'cvs diff -c HTTP.c' follows
#
# patch BEGINS here:
Index: HTTP.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTTP.c,v
retrieving revision 1.166
diff -c -r1.166 HTTP.c
*** HTTP.c	1998/09/01 18:02:20	1.166
--- HTTP.c	1998/10/15 16:47:39
***************
*** 1042,1054 ****
  	    ** The target for the input stream pipe is set up using the
  	    ** stream stack.
  	    */
!             {
! 		HTStream *me=HTStreamStack(WWW_HTTP,
! 					   HTRequest_outputFormat(request),
! 					   HTRequest_outputStream(request),
! 					   request, YES);
! 		HTNet_setReadStream(net, me);
! 		HTRequest_setOutputConnected(request, YES);
  	    }
  
  	    /*
--- 1042,1061 ----
  	    ** The target for the input stream pipe is set up using the
  	    ** stream stack.
  	    */
! 	    {
!             /*
!             **  during a recovery, we might keep the same HTNet object.
!             **  if so, reuse it's read stream 
!             */
!             HTStream * me = HTNet_readStream( net );
!             if ( me == NULL ) {
!                 me=HTStreamStack(WWW_HTTP,
! 				                 HTRequest_outputFormat(request),
! 				                 HTRequest_outputStream(request),
! 				                 request, YES);
! 				HTNet_setReadStream(net, me);
!             }
!             HTRequest_setOutputConnected(request, YES);
  	    }
  
  	    /*
# patch ENDS here
Received on Thursday, 15 October 1998 13:02:12 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 3 September 2003 17:59:19 EDT