From: Scott Mayhew <smayhew@redhat.com>
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] rpcbind: fix leak of nconf in main()
Date: Tue, 30 Jun 2026 12:13:58 -0400 [thread overview]
Message-ID: <20260630161358.133351-1-smayhew@redhat.com> (raw)
Before reusing nconf in the getnetconfig() loop, we need to free the
memory that was previously allocated via getnetconfigent(). Fixes the
following leak reported by valgrind:
==9031== 1,136 (136 direct, 1,000 indirect) bytes in 1 blocks are definitely lost in loss record 63 of 67
==9031== at 0x485183E: malloc (vg_replace_malloc.c:447)
==9031== by 0x4879D1F: getnetconfigent (in /usr/lib64/libtirpc.so.3.0.0)
==9031== by 0x4004336: main (rpcbind.c:271)
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
src/rpcbind.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/rpcbind.c b/src/rpcbind.c
index 4212377..c39df97 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -282,6 +282,7 @@ main(int argc, char *argv[])
rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
init_transport(nconf);
+ freenetconfigent(nconf);
while ((nconf = getnetconfig(nc_handle))) {
if (nconf->nc_flag & NC_VISIBLE)
--
2.54.0
next reply other threads:[~2026-06-30 16:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 16:13 Scott Mayhew [this message]
2026-07-01 15:36 ` [PATCH] rpcbind: fix leak of nconf in main() Steve Dickson
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=20260630161358.133351-1-smayhew@redhat.com \
--to=smayhew@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/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