From: Phil Sutter Date: Thu, 19 Oct 2017 08:18:41 +0000 (+0200) Subject: main: Fix for wrong argument passed to cache_release in nft_ctx_free X-Git-Tag: v0.8.1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4210b372ac78c8e85ecc6e2317b76daafba15c9;p=thirdparty%2Fnftables.git main: Fix for wrong argument passed to cache_release in nft_ctx_free nft_ctx_free() should not refer to the global 'nft' variable, this will break as soon as the function is moved away from main.c. In order to use the cache reference from passed argument, the latter must not be const. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/main.c b/src/main.c index b59c932a..1b268380 100644 --- a/src/main.c +++ b/src/main.c @@ -305,13 +305,13 @@ static struct nft_ctx *nft_ctx_new(uint32_t flags) return ctx; } -static void nft_ctx_free(const struct nft_ctx *ctx) +static void nft_ctx_free(struct nft_ctx *ctx) { if (ctx->nf_sock) netlink_close_sock(ctx->nf_sock); iface_cache_release(); - cache_release(&nft->cache); + cache_release(&ctx->cache); xfree(ctx); nft_exit(); }