Re: Bug in HTRequest_setOutputStream???

On Wed, Feb 19, 2003 at 10:27:14AM -0600, Mark Boudreaux wrote:
> target is allocated memory by HTStreamToChunk but then it is allocated
> memory a second time with HTRequest_setOutputStream.
>  
> I may be off base here but from the way I read the code
> HTRequest_setOutputStream should be changed.
>  
> Feedback, corrections, comments?

I don't think your suggested fix is the right solution. You're changing the
behaviour of HTRequest_setOutputStream(), but IMHO the bug is in the post
code.

If you grep for HTRequest_setOutputStream() in the code, it is used in lots
of other places, and all those places rely on the fact that there will be
no attempt to free the stream object. You'd probably get a lot of double
free()s with the change in place. Test it with valgrind!

Maybe the post code should manually do what your changed version of 
HTRequest_setOutputStream() would have done, or (cleaner) there should be 
an alternative version, "HTRequest_setOutputStream_autoFree()".

Cheers,

  Richard

-- 
  __   _
  |_) /|  Richard Atterer     |  CS student at the Technische  |  GnuPG key:
  | \/¯|  http://atterer.net  |  Universität München, Germany  |  0x888354F7
  ¯ '` ¯

Received on Wednesday, 19 February 2003 16:54:10 UTC