Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735577 > unrolled thread

[PATCH] netfilter: nf_tables: Release memory obtained by kasprintf

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-09-20 09:10 +0200
Last post2017-09-20 09:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] netfilter: nf_tables: Release memory obtained by kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-20 09:10 +0200

#1735577 — [PATCH] netfilter: nf_tables: Release memory obtained by kasprintf

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-09-20 09:10 +0200
Subject[PATCH] netfilter: nf_tables: Release memory obtained by kasprintf
Message-ID<urHiY-8bg-71@gated-at.bofh.it>
Free memory region, if nf_tables_set_alloc_name is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 net/netfilter/nf_tables_api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 9299271..393e37e 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2741,8 +2741,10 @@ static int nf_tables_set_alloc_name(struct nft_ctx *ctx, struct nft_set *set,
 	list_for_each_entry(i, &ctx->table->sets, list) {
 		if (!nft_is_active_next(ctx->net, i))
 			continue;
-		if (!strcmp(set->name, i->name))
+		if (!strcmp(set->name, i->name)) {
+			kfree(set->name);
 			return -ENFILE;
+		}
 	}
 	return 0;
 }
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web