nft: fix leak of rule and chain iterators
This patch fixes the leak of chain and rule iterators.
Signed-off-by: Giuseppe Longo <giuseppelng@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
diff --git a/iptables/nft.c b/iptables/nft.c
index 7dad246..6a4898d 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -1118,6 +1118,7 @@
c = nft_chain_list_iter_next(iter);
}
+ nft_chain_list_iter_destroy(iter);
nft_chain_list_free(list);
return 1;
@@ -1206,6 +1207,7 @@
r = nft_rule_list_iter_next(iter);
}
+ nft_rule_list_iter_destroy(iter);
nft_rule_list_free(list);
/* the core expects 1 for success and 0 for error */
@@ -1283,6 +1285,7 @@
c = nft_chain_list_iter_next(iter);
}
+ nft_chain_list_iter_destroy(iter);
err:
nft_chain_list_free(list);
@@ -1396,6 +1399,7 @@
c = nft_chain_list_iter_next(iter);
}
+ nft_chain_list_iter_destroy(iter);
err:
nft_chain_list_free(list);