Kaydet (Commit) 85aa507f authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Avoid memory leaks upon (de)compression failure

This e.g. reduces the LSan-reported leakage during CppunitTest_sd_filters_test
from

  SUMMARY: AddressSanitizer: 504104 byte(s) leaked in 4654 allocation(s).

to

  SUMMARY: AddressSanitizer: 115048 byte(s) leaked in 4639 allocation(s).

Change-Id: If922e872d9f696847face198e082144ccd5f12de
üst be343661
......@@ -82,17 +82,20 @@ long ZCodec::EndCompression()
{
long retvalue = 0;
if (mbStatus && meState != STATE_INIT)
if (meState != STATE_INIT)
{
if (meState == STATE_COMPRESS)
{
do
if (mbStatus)
{
do
{
ImplWriteBack();
}
while ( deflate( PZSTREAM, Z_FINISH ) != Z_STREAM_END );
ImplWriteBack();
}
while ( deflate( PZSTREAM, Z_FINISH ) != Z_STREAM_END );
ImplWriteBack();
retvalue = PZSTREAM->total_in;
deflateEnd( PZSTREAM );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment