[PATCH] uniq: memleak fix

Leonid Lisovskiy lly.dev at gmail.com
Sun Aug 30 16:04:52 UTC 2009


This patches fix memleak in uniq applet.

Originally, I got this patch from OpenWRT project -
https://dev.openwrt.org/browser/trunk/package/busybox/patches/430-uniq_memleak.patch?rev=6313

Regards,
   Leonid

--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -82,6 +82,8 @@ int uniq_main(int argc ATTRIBUTE_UNUSED,

 			if (!s0 || strncmp(e0, e1, max_chars)) {
 				break;
+			} else {
+				free((char *)s1);
 			}

 			++dups;	 /* note: testing for overflow seems excessive. */


More information about the busybox mailing list