Blob Blame History Raw
From a5241b8fcd2f62d8e71bf9dfebfbcf27a8a61e46 Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Fri, 6 Dec 2019 17:31:16 +0100
Subject: [PATCH] chain: Fix memleak in error path of nftnl_chain_parse_devs()

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1778952
Upstream Status: libnftnl commit 32a8c5f52355e

commit 32a8c5f52355ef69bf74c28e27345b2e03d948e7
Author: Phil Sutter <phil@nwl.cc>
Date:   Mon Dec 2 23:00:20 2019 +0100

    chain: Fix memleak in error path of nftnl_chain_parse_devs()

    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>
    Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/chain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/chain.c b/src/chain.c
index d4050d2..9cc8735 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;
 }
 
-- 
1.8.3.1