From 6558f6f7de3dfac069c1bc3f32d46d8deed64d03 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 9 Dec 2004 04:07:14 +0000 Subject: [PATCH] This comment is incorrect. deflateReset() doesn't leak; it resets the object to a just-initialized state. deflateEnd() is correct (no comment needed for that; it's obvious, I don't know why I used deflateReset to begin with). zlib doesn't appear to do anything special with allocations; running the following: #include main() { z_stream z; z.zalloc = NULL; z.zfree = NULL; inflateInit2( &z, -MAX_WBITS ); inflateReset( &z ); } under Valgrind shows: ==17033== 7080 bytes in 1 blocks are possibly lost in loss record 1 of 1 ==17033== at 0x1B904EDD: malloc (vg_replace_malloc.c:131) ==17033== by 0x1B91D4B4: zcalloc (in /usr/lib/libz.so.1.2.1.2) ==17033== by 0x1B91D608: inflateInit2_ (in /usr/lib/libz.so.1.2.1.2) ==17033== by 0x80485A4: main (in /home/glenn/a.out) --- stepmania/src/RageFileDriverZip.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/stepmania/src/RageFileDriverZip.cpp b/stepmania/src/RageFileDriverZip.cpp index 72a794a61f..c793a966a5 100644 --- a/stepmania/src/RageFileDriverZip.cpp +++ b/stepmania/src/RageFileDriverZip.cpp @@ -502,11 +502,6 @@ RageFileObjZipDeflated::RageFileObjZipDeflated( const RageFileObjZipDeflated &cp RageFileObjZipDeflated::~RageFileObjZipDeflated() { - //We MUST use inflateEnd() here insted of inflateReset(). Use - //of inflateReset() will cause large quantities of globally - //allocated ram to be leaked, making it impervious to most leak - //detection. See zlib.h documentation on inflateReset() for - //more information. int err = inflateEnd( &dstrm ); if( err != Z_OK ) LOG->Trace( "Huh? inflateEnd() err = %i", err );