All of lore.kernel.org
 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: [nft PATCH] cli: Make valgrind happy
Date: Tue, 20 Jun 2023 16:03:52 +0200	[thread overview]
Message-ID: <20230620140352.21633-1-phil@nwl.cc> (raw)

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.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/cli.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/cli.c b/src/cli.c
index 11fc85abeaa2b..bc7f64ef0b762 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -126,6 +126,7 @@ static void cli_complete(char *line)
 	if (line == NULL) {
 		printf("\n");
 		cli_exit();
+		nft_ctx_free(cli_nft);
 		exit(0);
 	}
 
@@ -141,6 +142,7 @@ static void cli_complete(char *line)
 
 	if (!strcmp(line, CMDLINE_QUIT)) {
 		cli_exit();
+		nft_ctx_free(cli_nft);
 		exit(0);
 	}
 
@@ -244,6 +246,7 @@ int cli_init(struct nft_ctx *nft)
 		linenoiseFree(line);
 	}
 	cli_exit();
+	nft_ctx_free(nft);
 	exit(0);
 }
 
-- 
2.40.0


             reply	other threads:[~2023-06-20 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 14:03 Phil Sutter [this message]
2023-06-20 16:04 ` [nft PATCH] cli: Make valgrind happy Pablo Neira Ayuso
2023-06-21 12:12   ` Phil Sutter
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=20230620140352.21633-1-phil@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.