From cb11cbb01fb638cf5713f5715653c099e7019155 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Jul 2023 10:45:19 +0200 Subject: libnftables: drop check for nf_sock in nft_ctx_free() The "nft_ctx" API does not provide a way to change or reconnect the netlink socket. And none of the users would rely on that. Also note that nft_ctx_new() initializes nf_sock via nft_mnl_socket_open(), which panics of the socket could not be initialized. This means, the check is unnecessary and needlessly confusing. Drop it. Signed-off-by: Thomas Haller Signed-off-by: Pablo Neira Ayuso --- src/libnftables.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/libnftables.c') diff --git a/src/libnftables.c b/src/libnftables.c index 79dfdfc7..6fc4f7db 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -337,8 +337,7 @@ const char *nft_ctx_get_error_buffer(struct nft_ctx *ctx) EXPORT_SYMBOL(nft_ctx_free); void nft_ctx_free(struct nft_ctx *ctx) { - if (ctx->nf_sock) - mnl_socket_close(ctx->nf_sock); + mnl_socket_close(ctx->nf_sock); exit_cookie(&ctx->output.output_cookie); exit_cookie(&ctx->output.error_cookie); -- cgit v1.2.3