From 03886d5908fe4ba44a056d8297cc7b48c91a8f15 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 14 Aug 2013 01:07:13 +0200 Subject: rule: release expressions that are part of rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ==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 Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 5 +++++ 1 file changed, 5 insertions(+) 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) -- cgit v1.2.3