summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-06-12 11:49:52 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-12-30 23:50:32 +0100
commit2c5850147937cd3da104adf654cc7b2d1f0c0a0b (patch)
tree25de5357270154c38ea43b5748d1a8cd4d2bac7f
parent34c59adfae98515468ec50c644c30115fee0b97e (diff)
nft: fix leaks in nft_xtables_config_load
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--iptables/nft.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/iptables/nft.c b/iptables/nft.c
index 1c7c75eb..a67f8754 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2816,6 +2816,8 @@ int nft_xtables_config_load(struct nft_handle *h, const char *filename,
"table `%s' cannot be create, reason `%s'. Exitting\n",
(char *)nft_table_attr_get(table, NFT_TABLE_ATTR_NAME),
strerror(errno));
+ nft_table_list_iter_destroy(titer);
+ nft_table_list_free(table_list);
return -1;
}
continue;
@@ -2823,6 +2825,8 @@ 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);
+ nft_table_list_free(table_list);
/* Stage 2) create chains */
citer = nft_chain_list_iter_create(chain_list);
@@ -2838,6 +2842,8 @@ int nft_xtables_config_load(struct nft_handle *h, const char *filename,
"chain `%s' cannot be create, reason `%s'. Exitting\n",
(char *)nft_chain_attr_get(chain, NFT_CHAIN_ATTR_NAME),
strerror(errno));
+ nft_chain_list_iter_destroy(citer);
+ nft_chain_list_free(chain_list);
return -1;
}
continue;
@@ -2848,5 +2854,8 @@ 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);
+ nft_chain_list_free(chain_list);
+
return 0;
}