diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-08-24 17:56:38 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-08-24 19:27:51 +0200 |
commit | d3d56d0fe1856b7fe27584eb90e8349e883cd56b (patch) | |
tree | c9c2a96fa517caaed4fc3c4f2ade222fee8c7d7d /src | |
parent | 07af227be805e83b5f45248d1fc544092b307be5 (diff) |
src: call nft_init() and nft_exit() from context routines
So we don't forget all these caches should be placed into struct
nft_ctx.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -259,7 +259,7 @@ err1: return ret; } -void nft_init(void) +static void nft_init(void) { mark_table_init(); realm_table_rt_init(); @@ -272,7 +272,7 @@ void nft_init(void) #endif } -void nft_exit(void) +static void nft_exit(void) { ct_label_table_exit(); realm_table_rt_exit(); @@ -285,6 +285,7 @@ static struct nft_ctx *nft_ctx_new(void) { struct nft_ctx *ctx; + nft_init(); ctx = xzalloc(sizeof(struct nft_ctx)); ctx->include_paths[0] = DEFAULT_INCLUDE_PATH; @@ -300,6 +301,7 @@ static void nft_ctx_free(const struct nft_ctx *ctx) iface_cache_release(); cache_release(&nft->cache); xfree(ctx); + nft_exit(); } static int nft_run_cmd_from_buffer(struct nft_ctx *nft, @@ -361,8 +363,6 @@ int main(int argc, char * const *argv) struct parser_state state; int i, val, rc; - nft_init(); - nft = nft_ctx_new(); nf_sock = netlink_open_sock(); @@ -478,7 +478,6 @@ int main(int argc, char * const *argv) xfree(buf); netlink_close_sock(nf_sock); nft_ctx_free(nft); - nft_exit(); return rc; } |