summaryrefslogtreecommitdiffstats
path: root/src/libnftables.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnftables.c')
-rw-r--r--src/libnftables.c9
1 files changed, 7 insertions, 2 deletions
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();
}