netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nft PATCH 0/4] cli: Make valgrind (kind of) happy
@ 2023-06-22 15:46 Phil Sutter
  2023-06-22 15:46 ` [nft PATCH 1/4] main: Make 'buf' variable branch-local Phil Sutter
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Phil Sutter @ 2023-06-22 15:46 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

The following series is more or less a v2 of my previous single patch
adding nft_ctx_free() calls to cli.c, following a different path:
Eliminate any program exit points from cli.c so nft context deinit at
end of main() happens. This is nicer design as said function allocates
the context in the first place.

Patch 1 is minor cleanup, patch 2 updates main() to free the context in
all cases, too and patch 3 then changes CLI code as described above.
Patch 4 extends shell testsuite by a '-V' (valgrind) mode as present in
iptables' shell testsuite already which wraps all calls to $NFT by
valgrind and collects non-empty logs.

Sadly, I could not eliminate all valgrind complaints because each of the
three CLI backends leaves allocated memory in place at exit. None seem
to have sufficient deinit functions, except linenoise - but that code
runs only for terminals put in raw mode.

Phil Sutter (4):
  main: Make 'buf' variable branch-local
  main: Call nft_ctx_free() before exiting
  cli: Make cli_init() return to caller
  tests: shell: Introduce valgrind mode

 include/cli.h            |  2 +-
 src/cli.c                | 63 ++++++++++++++++++++++++++--------------
 src/main.c               | 42 +++++++++++++++------------
 tests/shell/run-tests.sh | 47 ++++++++++++++++++++++++++++++
 4 files changed, 113 insertions(+), 41 deletions(-)

-- 
2.40.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-04 11:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-22 15:46 [nft PATCH 0/4] cli: Make valgrind (kind of) happy Phil Sutter
2023-06-22 15:46 ` [nft PATCH 1/4] main: Make 'buf' variable branch-local Phil Sutter
2023-06-22 15:46 ` [nft PATCH 2/4] main: Call nft_ctx_free() before exiting Phil Sutter
2023-06-22 15:46 ` [nft PATCH 3/4] cli: Make cli_init() return to caller Phil Sutter
2023-06-22 15:46 ` [nft PATCH 4/4] tests: shell: Introduce valgrind mode Phil Sutter
2023-07-04 11:04 ` [nft PATCH 0/4] cli: Make valgrind (kind of) happy Phil Sutter

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).