netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xtables: fix memory leak in command_jump
@ 2013-12-02 10:44 Ana Rey
  2013-12-03 17:53 ` Ana Rey
  0 siblings, 1 reply; 2+ messages in thread
From: Ana Rey @ 2013-12-02 10:44 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Ana Rey

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xtables: fix memory leak in command_jump
  2013-12-02 10:44 [PATCH] xtables: fix memory leak in command_jump Ana Rey
@ 2013-12-03 17:53 ` Ana Rey
  0 siblings, 0 replies; 2+ messages in thread
From: Ana Rey @ 2013-12-03 17:53 UTC (permalink / raw)
  To: netfilter-devel

2013/12/2 Ana Rey <anarey@gmail.com>:
> 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==

Please, withdraw this patch, I detected a problem in it.



> ---
>  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
>



-- 
Ana Rey (@anaRB)
http://www.anarey.info
http://about.me/anarey

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-03 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-02 10:44 [PATCH] xtables: fix memory leak in command_jump Ana Rey
2013-12-03 17:53 ` Ana Rey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).