netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH] cli: Make valgrind happy
Date: Wed, 21 Jun 2023 14:12:51 +0200	[thread overview]
Message-ID: <ZJLpQ0Wxnek0dtVQ@orbyte.nwl.cc> (raw)
In-Reply-To: <ZJHOEff+hNaj6g8e@calendula>

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

  reply	other threads:[~2023-06-21 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 14:03 [nft PATCH] cli: Make valgrind happy Phil Sutter
2023-06-20 16:04 ` Pablo Neira Ayuso
2023-06-21 12:12   ` Phil Sutter [this message]
2023-06-21 14:49     ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZJLpQ0Wxnek0dtVQ@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).