On Tue, Jun 20, 2023 at 06:04:33PM +0200, Pablo Neira Ayuso wrote: > On Tue, Jun 20, 2023 at 04:03:52PM +0200, Phil Sutter wrote: > > Missing call to nft_ctx_free() upsets valgrind enough to suspect > > possible losses, add them where sensible. This fixes reports with > > readline-lined builds at least. The same code is shared for libedit > > though, and there's an obvious spot for linenoise. > > Maybe call nft_ctx_free() from cli_exit() ? That's doable, but linenoise code does not use the static global cli_nft variable and thus cli_exit() can't access the struct nft_ctx pointer. At first, I tried to make main() not exit after calling cli_init() so final cleanup takes place. But the different CLI variants are a bit of a mess in that regard: While there are code-paths returning to caller, most don't. I'm tempted to fix that instead. What do you think? Thanks, Phil