summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-08-14 01:07:13 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-08-14 01:07:13 +0200
commit03886d5908fe4ba44a056d8297cc7b48c91a8f15 (patch)
treea19a605fb50555e6596a3449ba3b1b9b95cf1543
parent063da5bcaaf58e3ab6b86eacd6a4c958541a97bd (diff)
rule: release expressions that are part of rules
==11917== 96 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==11917== at 0x4C272B8: calloc (vg_replace_malloc.c:566) ==11917== by 0x4E3A46F: nft_rule_expr_alloc (expr.c:38) ==11917== by 0x4E3A331: nft_jansson_expr_parse (jansson.c:165) ==11917== by 0x4E36F66: nft_rule_json_parse (rule.c:542) ==11917== by 0x400EA4: main (nft-rule-json-add.c:68) Reported-by: Álvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/rule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rule.c b/src/rule.c
index f2b714e..4b5ffa6 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -64,6 +64,11 @@ EXPORT_SYMBOL(nft_rule_alloc);
void nft_rule_free(struct nft_rule *r)
{
+ struct nft_rule_expr *e, *tmp;
+
+ list_for_each_entry_safe(e, tmp, &r->expr_list, head)
+ nft_rule_expr_free(e);
+
if (r->table != NULL)
xfree(r->table);
if (r->chain != NULL)