Boost logo

Boost :

From: George M. Garner Jr. (gmgarner_at_[hidden])
Date: 2005-03-30 21:26:06


Johnathan,

I'm getting a memory leak when using the gzip_decompressor due to a failure
to call inflateEnd/deflateEnd during object destruction. I have inserted
the following line into zlib.cpp tp correct the problem:

void zlib_base::reset(bool compress)
{
z_stream* s = static_cast<z_stream*>(stream_);
zlib_error::check(compress ? deflateReset(s) : inflateReset(s));
zlib_error::check(compress ? deflateEnd(s) : inflateEnd(s)); // gmg cleanup
stream->state and embedded pointers
}

There may be a better place for this, for example in the zlib destructor,
since it may be desirable on occasion to reset a stream without destroying
the state (??). Or perhaps there should be a new function to encapsulate
the call to deflateEnd/inflateEnd which is called in the destructor.

Regards,

George.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk