[PATCH libnfntl] set: free user data

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

 



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

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