diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cli.c | 3 | ||||
-rw-r--r-- | src/libnftables.c | 9 |
2 files changed, 8 insertions, 4 deletions
@@ -140,8 +140,7 @@ static void cli_complete(char *line) nft_run(cli_nft, cli_nf_sock, scanner, state, &msgs); erec_print_list(&cli_nft->output, &msgs, cli_nft->debug_mask); xfree(line); - cache_release(&cli_nft->cache); - iface_cache_release(); + nft_ctx_flush_cache(cli_nft); } static char **cli_completion(const char *text, int start, int end) diff --git a/src/libnftables.c b/src/libnftables.c index 9bc51dd8..d34e5275 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -147,13 +147,18 @@ struct nft_ctx *nft_ctx_new(uint32_t flags) return ctx; } +void nft_ctx_flush_cache(struct nft_ctx *ctx) +{ + iface_cache_release(); + cache_release(&ctx->cache); +} + void nft_ctx_free(struct nft_ctx *ctx) { if (ctx->nf_sock) netlink_close_sock(ctx->nf_sock); - iface_cache_release(); - cache_release(&ctx->cache); + nft_ctx_flush_cache(ctx); xfree(ctx); nft_exit(); } |