[PATCH] xtables: fix memory leak in command_jump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This error is shown with valgrind tool:

valgrind --leak-check=full xtables -A INPUT -i eth0 -p tcp --dport 80

==7377==
==7377== 40 bytes in 1 blocks are still reachable in loss record 4 of 14
==7377==    at 0x4C2B514: calloc (vg_replace_malloc.c:593)
==7377==    by 0x52448C8: xtables_calloc (xtables.c:272)
==7377==    by 0x41487B: do_commandx (xtables.c:618)
==7377==    by 0x4134DC: xtables_main (xtables-standalone.c:72)
==7377==    by 0x5B87994: (below main) (libc-start.c:260)
==7377==
---
 iptables/xtables.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/iptables/xtables.c b/iptables/xtables.c
index c49b4a2..b5fff8c 100644
--- a/iptables/xtables.c
+++ b/iptables/xtables.c
@@ -638,6 +638,8 @@ static void command_jump(struct iptables_command_state *cs)
 		opts = xtables_merge_options(xtables_globals.orig_opts, opts,
 					     cs->target->extra_opts,
 					     &cs->target->option_offset);
+	free(cs->target->t);
+
 	if (opts == NULL)
 		xtables_error(OTHER_PROBLEM, "can't alloc memory!");
 }
-- 
1.8.4.rc3

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux