netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [libnftnl PATCH 2/4] chain: Fix memleak in error path of nftnl_chain_parse_devs()
Date: Mon,  2 Dec 2019 23:23:59 +0100	[thread overview]
Message-ID: <20191202222401.867-3-phil@nwl.cc> (raw)
In-Reply-To: <20191202222401.867-1-phil@nwl.cc>

In error case, dev_array is not freed when it should.

Fixes: e3ac19b5ec162 ("chain: multi-device support")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/chain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/chain.c b/src/chain.c
index d4050d28e77d0..9cc8735a4936f 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -636,6 +636,7 @@ static int nftnl_chain_parse_devs(struct nlattr *nest, struct nftnl_chain *c)
 err:
 	while (len--)
 		xfree(dev_array[len]);
+	xfree(dev_array);
 	return -1;
 }
 
-- 
2.24.0


  parent reply	other threads:[~2019-12-02 22:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02 22:23 [libnftnl PATCH 0/4] Fix covscan-detected issues Phil Sutter
2019-12-02 22:23 ` [libnftnl PATCH 1/4] flowtable: Fix memleak in error path of nftnl_flowtable_parse_devs() Phil Sutter
2019-12-02 22:23 ` Phil Sutter [this message]
2019-12-02 22:24 ` [libnftnl PATCH 3/4] flowtable: Correctly check realloc() call Phil Sutter
2019-12-02 22:24 ` [libnftnl PATCH 4/4] chain: " Phil Sutter
2019-12-02 23:50 ` [libnftnl PATCH 0/4] Fix covscan-detected issues Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191202222401.867-3-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).