netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
To: netfilter-devel@vger.kernel.org
Cc: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Subject: [iptables-nftables PATCH 2/6] xtables: destroy list iterator relevantly
Date: Tue, 14 May 2013 13:52:03 +0300	[thread overview]
Message-ID: <1368528727-10127-3-git-send-email-tomasz.bursztyka@linux.intel.com> (raw)
In-Reply-To: <1368528727-10127-1-git-send-email-tomasz.bursztyka@linux.intel.com>

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---
 iptables/nft.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/iptables/nft.c b/iptables/nft.c
index f5d96bc..574383d 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -1119,6 +1119,7 @@ next:
 		c = nft_chain_list_iter_next(iter);
 	}
 
+	nft_chain_list_iter_destroy(iter);
 	nft_chain_list_free(list);
 
 	return 1;
@@ -1248,7 +1249,7 @@ int nft_rule_flush(struct nft_handle *h, const char *chain, const char *table)
 {
 	int ret;
 	struct nft_chain_list *list;
-	struct nft_chain_list_iter *iter;
+	struct nft_chain_list_iter *iter = NULL;
 	struct nft_chain *c;
 
 	nft_fn = nft_rule_flush;
@@ -1285,6 +1286,7 @@ next:
 	}
 
 err:
+	nft_chain_list_iter_destroy(iter);
 	nft_chain_list_free(list);
 
 	/* the core expects 1 for success and 0 for error */
@@ -1356,7 +1358,7 @@ static bool nft_chain_builtin(struct nft_chain *c)
 int nft_chain_user_del(struct nft_handle *h, const char *chain, const char *table)
 {
 	struct nft_chain_list *list;
-	struct nft_chain_list_iter *iter;
+	struct nft_chain_list_iter *iter = NULL;
 	struct nft_chain *c;
 	int ret = 0;
 	int deleted_ctr = 0;
@@ -1398,6 +1400,7 @@ next:
 	}
 
 err:
+	nft_chain_list_iter_destroy(iter);
 	nft_chain_list_free(list);
 
 	/* chain not found */
@@ -1580,6 +1583,7 @@ bool nft_table_find(struct nft_handle *h, const char *tablename)
 		t = nft_table_list_iter_next(iter);
 	}
 
+	nft_table_list_iter_destroy(iter);
 	nft_table_list_free(list);
 
 err:
@@ -1617,6 +1621,7 @@ int nft_for_each_table(struct nft_handle *h,
 		t = nft_table_list_iter_next(iter);
 	}
 
+	nft_table_list_iter_destroy(iter);
 	nft_table_list_free(list);
 
 err:
@@ -2521,6 +2526,7 @@ next:
 		c = nft_chain_list_iter_next(iter);
 	}
 
+	nft_chain_list_iter_destroy(iter);
 	nft_chain_list_free(list);
 
 	return 1;
@@ -2575,6 +2581,7 @@ next:
 		c = nft_chain_list_iter_next(iter);
 	}
 
+	nft_chain_list_iter_destroy(iter);
 	return 1;
 }
 
@@ -2615,6 +2622,7 @@ next:
 		c = nft_chain_list_iter_next(iter);
 	}
 
+	nft_chain_list_iter_destroy(iter);
 	nft_chain_list_free(list);
 
 	return 1;
@@ -2821,6 +2829,7 @@ int nft_xtables_config_load(struct nft_handle *h, const char *filename,
 		xtables_config_perror(flags, "table `%s' has been created\n",
 			(char *)nft_table_attr_get(table, NFT_TABLE_ATTR_NAME));
 	}
+	nft_table_list_iter_destroy(titer);
 
 	/* Stage 2) create chains */
 	citer = nft_chain_list_iter_create(chain_list);
@@ -2846,5 +2855,6 @@ int nft_xtables_config_load(struct nft_handle *h, const char *filename,
 			(char *)nft_chain_attr_get(chain, NFT_CHAIN_ATTR_NAME),
 			(char *)nft_chain_attr_get(chain, NFT_CHAIN_ATTR_TABLE));
 	}
+	nft_chain_list_iter_destroy(citer);
 	return 0;
 }
-- 
1.8.2.1


  parent reply	other threads:[~2013-05-14 10:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-14 10:49 [iptables-nftables/libnfables PATCHES] Target translation to nftables Tomasz Bursztyka
2013-05-14 10:51 ` [libnftables PATCH 0/7] Fixes and features Tomasz Bursztyka
2013-05-14 10:51   ` [libnftables PATCH 1/7] git: add a .gitignore file Tomasz Bursztyka
2013-05-14 22:17     ` Pablo Neira Ayuso
2013-05-15  6:51       ` Tomasz Bursztyka
2013-05-15 12:53         ` Pablo Neira Ayuso
2013-05-15 13:01           ` Tomasz Bursztyka
2013-05-14 10:51   ` [libnftables PATCH 2/7] build: add an autogen.sh script Tomasz Bursztyka
2013-05-14 10:51   ` [libnftables PATCH 3/7] rule: declare nft_rule_list structure at a proper place Tomasz Bursztyka
2013-05-14 10:51   ` [libnftables PATCH 4/7] expr: remove inconsistent and non implemented function Tomasz Bursztyka
2013-05-14 10:51   ` [libnftables PATCH 5/7] map: fix nft_rule_expr_build_payload export Tomasz Bursztyka
2013-05-14 10:51   ` [libnftables PATCH 6/7] expr: add support for expr list and capability to add it into a rule Tomasz Bursztyka
2013-05-14 10:51   ` [libnftables PATCH 7/7] chain: handle attribute is relevant if only there is no name to use Tomasz Bursztyka
2013-05-14 22:20     ` Pablo Neira Ayuso
2013-05-15  6:08       ` Tomasz Bursztyka
2013-05-15 12:43         ` Pablo Neira Ayuso
2013-05-15 13:06           ` Tomasz Bursztyka
2013-05-15 13:40             ` Pablo Neira Ayuso
2013-05-15 13:54               ` Tomasz Bursztyka
2013-05-15 14:28                 ` Pablo Neira Ayuso
2013-05-16 16:46   ` [libnftables PATCH 0/7] Fixes and features Pablo Neira Ayuso
2013-05-14 10:52 ` [iptables-nftables PATCH 0/6] " Tomasz Bursztyka
2013-05-14 10:52   ` [iptables-nftables PATCH 1/6] xtables: initialize xtables defaults even on listing rules Tomasz Bursztyka
2013-05-16 17:01     ` Pablo Neira Ayuso
2013-05-14 10:52   ` Tomasz Bursztyka [this message]
2013-05-16 17:02     ` [iptables-nftables PATCH 2/6] xtables: destroy list iterator relevantly Pablo Neira Ayuso
2013-05-14 10:52   ` [iptables-nftables PATCH 3/6] xtables: policy can be changed only on builtin chain Tomasz Bursztyka
2013-05-16 17:01     ` Pablo Neira Ayuso
2013-05-14 10:52   ` [iptables-nftables PATCH 4/6] xtables: Add support for translating xtables target into nft expressions Tomasz Bursztyka
2013-05-14 10:52   ` [iptables-nftables PATCH 5/6] xtables: add support for translating xtables matches " Tomasz Bursztyka
2013-05-14 10:52   ` [iptables-nftables PATCH 6/6] xtables: add suport for DNAT rule translation to nft extensions Tomasz Bursztyka
2013-05-14 22:30     ` Pablo Neira Ayuso
2013-05-15  6:48       ` Tomasz Bursztyka
2013-05-15 12:51         ` Pablo Neira Ayuso
2013-05-15 13:24           ` Tomasz Bursztyka
2013-05-15 13:49             ` 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=1368528727-10127-3-git-send-email-tomasz.bursztyka@linux.intel.com \
    --to=tomasz.bursztyka@linux.intel.com \
    --cc=netfilter-devel@vger.kernel.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).