Skip to contentSkip to conversation

set: free user data

PATCH In review Eric Leblond 2 participants 2 messages Jul 6, 2017 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 set: free user data

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
---
 src/set.c | 2 ++
 1 file changed, 2 insertions(+)
src/set.c +2 -0
index cce5e63..1158e38 100644
@@ -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);
Signature · 1 line
2.13.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · 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

Please go push this, thanks!