summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAlvaro Neira <alvaroneay@gmail.com>2015-03-12 17:33:09 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2015-03-13 12:18:20 +0100
commitd27456460a2867d69a6bbed8aa0019f65ab42eac (patch)
treec9f216ed01188d7e0e784d272c3057f5452a3959 /examples
parent1f92b04760f65c28498e7c4e20e8037fe66ecf44 (diff)
ruleset: add nft_ruleset_ctx_free
This function releases the ruleset objects attached in the parse context structure, ie. struct nft_parse_ctx. Moreover, this patch updates the nft_parse_ruleset_file to use it. Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/nft-ruleset-parse-file.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/examples/nft-ruleset-parse-file.c b/examples/nft-ruleset-parse-file.c
index 7d9086b..cac7d0d 100644
--- a/examples/nft-ruleset-parse-file.c
+++ b/examples/nft-ruleset-parse-file.c
@@ -77,10 +77,8 @@ static int nft_ruleset_set_elems(const struct nft_parse_ctx *ctx)
mnl_nlmsg_batch_next(batch);
nft_set_elems_iter_destroy(iter_elems);
- nft_set_free(set);
return 0;
err:
- nft_set_free(set);
return -1;
}
@@ -125,7 +123,6 @@ static int nft_ruleset_set(const struct nft_parse_ctx *ctx)
ret = nft_ruleset_set_elems(ctx);
return ret;
err:
- nft_set_free(set);
return -1;
}
@@ -184,7 +181,6 @@ static int nft_ruleset_rule(const struct nft_parse_ctx *ctx)
return -1;
ret = nft_ruleset_rule_build_msg(ctx, cmd, rule);
- nft_rule_free(rule);
return ret;
}
@@ -273,10 +269,8 @@ static int nft_ruleset_chain(const struct nft_parse_ctx *ctx)
nft_chain_nlmsg_build_payload(nlh, chain);
mnl_nlmsg_batch_next(batch);
- nft_chain_free(chain);
return 0;
err:
- nft_chain_free(chain);
return -1;
}
@@ -327,7 +321,6 @@ static int nft_ruleset_table(const struct nft_parse_ctx *ctx)
return -1;
ret = nft_ruleset_table_build_msg(ctx, cmd, table);
- nft_table_free(table);
return ret;
}
@@ -377,6 +370,7 @@ static int ruleset_elems_cb(const struct nft_parse_ctx *ctx)
return -1;
}
+ nft_ruleset_ctx_free(ctx);
return ret;
}