]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
main: Fix for wrong argument passed to cache_release in nft_ctx_free
authorPhil Sutter <phil@nwl.cc>
Thu, 19 Oct 2017 08:18:41 +0000 (10:18 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 20 Oct 2017 12:21:01 +0000 (14:21 +0200)
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 <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/main.c

index b59c932ad4299a32745014df035ceb8be139b8a8..1b26838058a4ae5dda70b2fe526ae0e396c2423a 100644 (file)
@@ -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();
 }