Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751793AbdITHC3 (ORCPT ); Wed, 20 Sep 2017 03:02:29 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33895 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbdITHC1 (ORCPT ); Wed, 20 Sep 2017 03:02:27 -0400 X-Google-Smtp-Source: AOwi7QCG5z/gzu76ao8Em3E06/EFdNfSw0G1bP+FsU8aAkXPwqMtJ4hebyU/JZANPaoyrb/FJtuNkg== From: Arvind Yadav To: pablo@netfilter.org, kadlec@blackhole.kfki.hu, fw@strlen.de, davem@davemloft.net Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] netfilter: nf_tables: Release memory obtained by kasprintf Date: Wed, 20 Sep 2017 12:31:28 +0530 Message-Id: <385554261c080cd3fc4adc093e68366a6d3dff77.1505889128.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 752 Lines: 25 Free memory region, if nf_tables_set_alloc_name is not successful. Signed-off-by: Arvind Yadav --- 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