diff options
author | Phil Sutter <phil@nwl.cc> | 2021-09-21 11:39:45 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-09-27 13:29:28 +0200 |
commit | 4318961230bce82958df82b57f1796143bf2f421 (patch) | |
tree | fcc023e0a78057c7d8d1fd2df2a1a5cb91a6f209 /iptables/nft-cache.c | |
parent | 040a15f27075ccded8d819af6cf0484c532515ef (diff) |
nft: cache: Avoid double free of unrecognized base-chains
On error, nft_cache_add_chain() frees the allocated nft_chain object
along with the nftnl_chain it points at. Fix nftnl_chain_list_cb() to
not free the nftnl_chain again in that case.
Fixes: 176c92c26bfc9 ("nft: Introduce a dedicated base chain array")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables/nft-cache.c')
-rw-r--r-- | iptables/nft-cache.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/iptables/nft-cache.c b/iptables/nft-cache.c index 2c88301c..9a03bbfb 100644 --- a/iptables/nft-cache.c +++ b/iptables/nft-cache.c @@ -314,9 +314,7 @@ static int nftnl_chain_list_cb(const struct nlmsghdr *nlh, void *data) goto out; } - if (nft_cache_add_chain(h, t, c)) - goto out; - + nft_cache_add_chain(h, t, c); return MNL_CB_OK; out: nftnl_chain_free(c); |