All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] src: obj: fix memleak in handle_free()
@ 2019-09-30  8:38 Eric Jallot
  2019-09-30  9:10 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Jallot @ 2019-09-30  8:38 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Eric Jallot

Using limit object as example:

 # valgrind --leak-check=full nft list ruleset
 ==9937== Memcheck, a memory error detector
 ==9937== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
 ==9937== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
 ==9937== Command: nft list ruleset
 ==9937==
 table inet raw {
         limit lim1 {
                 rate 1/second
         }
 }
 ==9937==
 ==9937== HEAP SUMMARY:
 ==9937==     in use at exit: 5 bytes in 1 blocks
 ==9937==   total heap usage: 50 allocs, 49 frees, 212,065 bytes allocated
 ==9937==
 ==9937== 5 bytes in 1 blocks are definitely lost in loss record 1 of 1
 ==9937==    at 0x4C29EA3: malloc (vg_replace_malloc.c:309)
 ==9937==    by 0x5C65AA9: strdup (strdup.c:42)
 ==9937==    by 0x4E720A3: xstrdup (utils.c:75)
 ==9937==    by 0x4E660FF: netlink_delinearize_obj (netlink.c:972)
 ==9937==    by 0x4E6641C: list_obj_cb (netlink.c:1064)
 ==9937==    by 0x50E8993: nftnl_obj_list_foreach (object.c:494)
 ==9937==    by 0x4E664EA: netlink_list_objs (netlink.c:1085)
 ==9937==    by 0x4E4FE82: cache_init_objects (rule.c:188)
 ==9937==    by 0x4E4FE82: cache_init (rule.c:221)
 ==9937==    by 0x4E4FE82: cache_update (rule.c:271)
 ==9937==    by 0x4E7716E: nft_evaluate (libnftables.c:406)
 ==9937==    by 0x4E778F7: nft_run_cmd_from_buffer (libnftables.c:447)
 ==9937==    by 0x40170F: main (main.c:326)

Fixes: 4756d92e517ae ("src: listing of stateful objects")
Signed-off-by: Eric Jallot <ejallot@gmail.com>
---
 src/rule.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/rule.c b/src/rule.c
index 0cc1fa595918..2d35bae44c9e 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -106,6 +106,7 @@ void handle_free(struct handle *h)
 	xfree(h->chain.name);
 	xfree(h->set.name);
 	xfree(h->flowtable);
+	xfree(h->obj.name);
 }
 
 void handle_merge(struct handle *dst, const struct handle *src)
-- 
2.11.0


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

* Re: [PATCH nft] src: obj: fix memleak in handle_free()
  2019-09-30  8:38 [PATCH nft] src: obj: fix memleak in handle_free() Eric Jallot
@ 2019-09-30  9:10 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2019-09-30  9:10 UTC (permalink / raw)
  To: Eric Jallot; +Cc: netfilter-devel

On Mon, Sep 30, 2019 at 10:38:23AM +0200, Eric Jallot wrote:
> Using limit object as example:
> 
>  # valgrind --leak-check=full nft list ruleset
>  ==9937== Memcheck, a memory error detector
>  ==9937== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
>  ==9937== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
>  ==9937== Command: nft list ruleset
>  ==9937==
>  table inet raw {
>          limit lim1 {
>                  rate 1/second
>          }
>  }

Applied, thanks.

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

end of thread, other threads:[~2019-09-30  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-30  8:38 [PATCH nft] src: obj: fix memleak in handle_free() Eric Jallot
2019-09-30  9:10 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.