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
This commit is contained in:
@@ -82,17 +82,20 @@ long ZCodec::EndCompression()
|
|||||||
{
|
{
|
||||||
long retvalue = 0;
|
long retvalue = 0;
|
||||||
|
|
||||||
if (mbStatus && meState != STATE_INIT)
|
if (meState != STATE_INIT)
|
||||||
{
|
{
|
||||||
if (meState == STATE_COMPRESS)
|
if (meState == STATE_COMPRESS)
|
||||||
{
|
{
|
||||||
do
|
if (mbStatus)
|
||||||
{
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ImplWriteBack();
|
||||||
|
}
|
||||||
|
while ( deflate( PZSTREAM, Z_FINISH ) != Z_STREAM_END );
|
||||||
|
|
||||||
ImplWriteBack();
|
ImplWriteBack();
|
||||||
}
|
}
|
||||||
while ( deflate( PZSTREAM, Z_FINISH ) != Z_STREAM_END );
|
|
||||||
|
|
||||||
ImplWriteBack();
|
|
||||||
|
|
||||||
retvalue = PZSTREAM->total_in;
|
retvalue = PZSTREAM->total_in;
|
||||||
deflateEnd( PZSTREAM );
|
deflateEnd( PZSTREAM );
|
||||||
|
Reference in New Issue
Block a user