summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorEric Leblond <eric@regit.org>2017-08-24 17:52:26 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-08-24 19:27:51 +0200
commit07af227be805e83b5f45248d1fc544092b307be5 (patch)
tree32871c28a5ba435e99552c362a382210782ff984 /src/main.c
parent3db28321b64a6d67947331f47f4e7b843ceee492 (diff)
src: release caches from nft_ctx_free() path
Release existing caches from nft_ctx_free(). Still, the iface cache should be good to place it in the nft_ctx structure. Joint work with Pablo Neira. Signed-off-by: Eric Leblond <eric@regit.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 8a3c097d..1df53adb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -297,6 +297,8 @@ static struct nft_ctx *nft_ctx_new(void)
static void nft_ctx_free(const struct nft_ctx *ctx)
{
+ iface_cache_release();
+ cache_release(&nft->cache);
xfree(ctx);
}
@@ -318,7 +320,6 @@ static int nft_run_cmd_from_buffer(struct nft_ctx *nft,
erec_print_list(stderr, &msgs, nft->debug_mask);
scanner_destroy(scanner);
- cache_release(&nft->cache);
return rc;
}
@@ -347,7 +348,6 @@ static int nft_run_cmd_from_filename(struct nft_ctx *nft,
err:
erec_print_list(stderr, &msgs, nft->debug_mask);
scanner_destroy(scanner);
- cache_release(&nft->cache);
return rc;
}
@@ -476,7 +476,6 @@ int main(int argc, char * const *argv)
}
xfree(buf);
- iface_cache_release();
netlink_close_sock(nf_sock);
nft_ctx_free(nft);
nft_exit();