netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libnfntl] set: free user data
@ 2017-07-06 13:05 Eric Leblond
  2017-07-06 13:49 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Leblond @ 2017-07-06 13:05 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel, Eric Leblond

This was causing a memory leak when using set.

Catched by an ASAN run:

==21004==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 12 byte(s) in 2 object(s) allocated from:
    #0 0x4cde58 in malloc (/usr/local/sbin/nft+0x4cde58)
    #1 0x7ffff79b8c19 in nftnl_set_set_data /home/eric/git/netfilter/libnftnl/src/set.c:179

Signed-off-by: Eric Leblond <eric@regit.org>
---
 src/set.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/set.c b/src/set.c
index cce5e63..1158e38 100644
--- a/src/set.c
+++ b/src/set.c
@@ -48,6 +48,8 @@ void nftnl_set_free(const struct nftnl_set *s)
 		xfree(s->table);
 	if (s->flags & (1 << NFTNL_SET_NAME))
 		xfree(s->name);
+	if (s->flags & (1 << NFTNL_SET_USERDATA))
+		xfree(s->user.data);
 
 	list_for_each_entry_safe(elem, tmp, &s->element_list, head) {
 		list_del(&elem->head);
-- 
2.13.1


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

* Re: [PATCH libnfntl] set: free user data
  2017-07-06 13:05 [PATCH libnfntl] set: free user data Eric Leblond
@ 2017-07-06 13:49 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-07-06 13:49 UTC (permalink / raw)
  To: Eric Leblond; +Cc: netfilter-devel

On Thu, Jul 06, 2017 at 02:05:39PM +0100, Eric Leblond wrote:
> This was causing a memory leak when using set.
> 
> Catched by an ASAN run:
> 
> ==21004==ERROR: LeakSanitizer: detected memory leaks
> 
> Direct leak of 12 byte(s) in 2 object(s) allocated from:
>     #0 0x4cde58 in malloc (/usr/local/sbin/nft+0x4cde58)
>     #1 0x7ffff79b8c19 in nftnl_set_set_data /home/eric/git/netfilter/libnftnl/src/set.c:179
> 
> Signed-off-by: Eric Leblond <eric@regit.org>

Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>

Please go push this, thanks!

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

end of thread, other threads:[~2017-07-06 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06 13:05 [PATCH libnfntl] set: free user data Eric Leblond
2017-07-06 13:49 ` Pablo Neira Ayuso

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