Date: Mon, 14 Mar 2005 21:43:52 +0100 From: Marco Molteni <molter@tin.it> To: freebsd-hackers@freebsd.org Subject: Re: memory leak in inflate.c Message-ID: <20050314214352.02af2827.molter@tin.it> In-Reply-To: <E40595640FD457418D8F9005C2BEC8496456D0@mvebe001.americas.nokia.com> References: <E40595640FD457418D8F9005C2BEC8496456D0@mvebe001.americas.nokia.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 14 Mar 2005 <Vijay.Singh@nokia.com> wrote: > Hi, I am trying to debug a memory leak in executing gzipped binaries > when the parameter list is too long. The function in question is > inflate_dynamic(). > > /* decompress until an end-of-block code */ > if (inflate_codes(glbl, tl, td, bl, bd)) > return 1; > > /* free the decoding tables, return */ > huft_free(glbl, tl); > huft_free(glbl, td); > return 0; > > > Should this be re-written as: > > i = inflate_codes(glbl, tl, td, bl, bd) ? 1 : 0; > > /* free the decoding tables, return */ > huft_free(glbl, tl); > huft_free(glbl, td); > > return (i); > > so that the Huffman tables are always freed. _If_ I remember correctly, if inflate_dynamic() returns a non-zero code it means that the decompression failed and the program itself quits right away, no memory leak. Or am I missing something? marco -- Very graphic, classical but efficient.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050314214352.02af2827.molter>