cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: 9K Memory Leak in "content-encoding.c"

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 7 Aug 2007 21:25:35 -0700

On Wed, Aug 08, 2007 at 11:25:33AM +0800, Song Ma wrote:
> I was running the testcase 221 and 223 under valgrind check. I found there are
> 9k memory leak in "content_encoding.c" according to the valgrind's leak report.
> Please refer to the attached files for details.
>
> I made one patch for this leak and here is the diff file. I am using the latest
> snapshot: "curl-7.17.0-20070807".
>
> Let me know what you think.

The whole point of calling inflateInit2 again is to reinitialize the stream
with different parameters, so commenting out the call defeats the purpose.
Try this patch instead and let me know if it fixes the problem:

diff -u -r1.24 content_encoding.c
--- content_encoding.c 22 Feb 2007 06:19:39 -0000 1.24
+++ content_encoding.c 8 Aug 2007 04:25:03 -0000
@@ -133,7 +133,7 @@
       /* some servers seem to not generate zlib headers, so this is an attempt
          to fix and continue anyway */
 
- inflateReset(z);
+ inflateEnd(z);
       if (inflateInit2(z, -MAX_WBITS) != Z_OK) {
         return process_zlib_error(conn, z);
       }

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-08-08