memory leak in inflate.c

Marc Olzheim marcolz at stack.nl
Tue Mar 15 12:51:19 PST 2005


On Tue, Mar 15, 2005 at 09:42:07PM +0100, Marc Olzheim wrote:
> > Thanks. Could someone generate the patch as I dont have the latest
> > FreeBSD source checked out.
> 
> Hmm, there seem to be more possible leaks, as the code has been
> literally copied from /usr/src/gnu/usr.bin/gzip/, including the define
> of PKZIP_BUG_WORKAROUND. Have you checked all possible problems, or did
> you just stumble onto this one ?

Ah, never mind, that PKZIP_BUG_WORKAROUND part seems to be ok.

Here it is.

Marc
-------------- next part --------------
--- kern/inflate.c	Tue Mar 15 21:46:14 2005
+++ kern/inflate.c	Tue Mar 15 21:46:22 2005
@@ -956,14 +956,15 @@
 		return i;	/* incomplete code set */
 #endif
 	}
+
 	/* decompress until an end-of-block code */
-	if (inflate_codes(glbl, tl, td, bl, bd))
-		return 1;
+	i = (inflate_codes(glbl, tl, td, bl, bd)) ? 1 : 0;
 
 	/* free the decoding tables, return */
 	huft_free(glbl, tl);
 	huft_free(glbl, td);
-	return 0;
+
+	return i;
 }
 
 /* decompress an inflated block */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20050315/204efa03/attachment.bin


More information about the freebsd-hackers mailing list