Linux NFS development
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Steve Dickson <steved@redhat.com>
Cc: libtirpc-devel@lists.sourceforge.net, linux-nfs@vger.kernel.org
Subject: [PATCH] rpcbind: fix double free in init_transport
Date: Sat, 29 Jan 2022 03:44:17 +0300	[thread overview]
Message-ID: <20220129004417.GA10610@altlinux.org> (raw)

$ rpcbind -h 127.0.0.1
free(): double free detected in tcache 2
Aborted

Fixes: a6889bba949b ("Removed resource leaks from src/rpcbind.c")
Resolves: https://sourceforge.net/p/rpcbind/bugs/6/
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 src/rpcbind.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/rpcbind.c b/src/rpcbind.c
index 25d8a90..ecebe97 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -552,8 +552,10 @@ init_transport(struct netconfig *nconf)
 				syslog(LOG_ERR, "cannot bind %s on %s: %m",
 					(hosts[nhostsbak] == NULL) ? "*" :
 					hosts[nhostsbak], nconf->nc_netid);
-				if (res != NULL)
+				if (res != NULL) {
 					freeaddrinfo(res);
+					res = NULL;
+				}
 				continue;
 			} else
 				checkbind++;
-- 
ldv

             reply	other threads:[~2022-01-29  0:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-29  0:44 Dmitry V. Levin [this message]
2022-02-01 13:48 ` [PATCH] rpcbind: fix double free in init_transport 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=20220129004417.GA10610@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=libtirpc-devel@lists.sourceforge.net \
    --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