cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] Memory leak in zlib error handling code in content_encoding.c

From: Andre Guibert de Bruet <andy_at_siliconlandmark.com>
Date: Sat, 14 Feb 2009 09:52:44 -0500

On Feb 14, 2009, at 4:07 AM, Daniel Stenberg wrote:

> On Fri, 13 Feb 2009, Andre Guibert de Bruet wrote:
>
>> I found a 64KB (DSIZ) memory leak in lib/content_encoding.c in the
>> zlib error handling code. I have attached a patch that addresses
>> the issue. Could it be committed upon review?
>
> It looks fine. I've committed it now,
>
>> Another item of interest: In the inflateInit2(z, -MAX_WBITS) !=
>> Z_OK case, the failure mode is to call process_zlib_error(conn, z)
>> instead of the exit_zlib(z, &k->zlib_init, process_zlib_error(conn,
>> z)) that is performed in the other failure modes in the same
>> function. Is there a technical reason for this that I am not
>> picking up on?
>
> I must agree with you that it looks like an oversight there. But
> doesn't this also result in a memory leak when inflateEnd() is never
> called?

My thoughts exactly! I have attached a patch that addresses this issue.

Cheers,
Andy

/* Andre Guibert de Bruet * 436f 6465 2070 6f65 742e 2042 6974 206a */
/* Managing Partner * 6f63 6b65 792e 2053 7973 4164 6d69 6e2e */
/* GSM: +1 734 846 8758 * 2055 4e49 5820 736c 6575 7468 2e00 0000 */
/* WWW: siliconlandmark.com * C/C++, Java, Perl, PHP, SQL, XHTML, XML */

Received on 2009-02-14