Linux NFS development
 help / color / mirror / Atom feed
From: Alice Mitchell <ajmitchell@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: Steve Dickson <steved@redhat.com>
Subject: [PATCH 1/4] nfs-utils: Fix potential memory leaks in idmap
Date: Fri, 06 Aug 2021 13:31:38 +0100	[thread overview]
Message-ID: <e0e036cb4e438fdeb5ed1b8a988dcb170907f012.camel@redhat.com> (raw)
In-Reply-To: <ee45aa412acaf7a2c035ad98e966394a7293dd9f.camel@redhat.com>


Signed-off-by: Alice Mitchell <ajmitchell@redhat.com>
---
 support/nfsidmap/nss.c   | 4 ++--
 support/nfsidmap/regex.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/support/nfsidmap/nss.c b/support/nfsidmap/nss.c
index 669760b..f00bd9b 100644
--- a/support/nfsidmap/nss.c
+++ b/support/nfsidmap/nss.c
@@ -365,9 +365,9 @@ static int _nss_name_to_gid(char *name, gid_t *gid,
int dostrip)
 out_buf:
 	free(buf);
 out_name:
-	if (dostrip)
+	if (localname)
 		free(localname);
-	if (get_reformat_group())
+	if (ref_name)
 		free(ref_name);
 out:
 	return err;
diff --git a/support/nfsidmap/regex.c b/support/nfsidmap/regex.c
index fdbb2e2..958b4ac 100644
--- a/support/nfsidmap/regex.c
+++ b/support/nfsidmap/regex.c
@@ -157,6 +157,7 @@ again:
 	IDMAP_LOG(4, ("regexp_getpwnam: name '%s' mapped to '%s'",
 		  name, localname));
 
+	free(localname);
 	*err_p = 0;
 	return pw;
 
-- 
2.27.0



  reply	other threads:[~2021-08-06 12:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 12:27 [PATCH 0/4] nfs-utils: A series of memory fixes Alice Mitchell
2021-08-06 12:31 ` Alice Mitchell [this message]
2021-08-06 19:14   ` [PATCH 1/4] nfs-utils: Fix potential memory leaks in idmap Olga Kornievskaia
2021-08-06 12:32 ` [PATCH 2/4] nfs-utils: Fix mem leaks in gssd Alice Mitchell
2021-08-06 19:12   ` Olga Kornievskaia
2021-08-12 13:19     ` Alice Mitchell
2021-08-06 12:33 ` [PATCH 3/4] nfs-utils: Fix mem leaks in krb5_util Alice Mitchell
2021-08-06 18:49   ` Olga Kornievskaia
2021-08-06 12:33 ` [PATCH 4/4] nfs-utils: Fix mem leak in mountd Alice Mitchell
2021-08-06 13:47 ` [PATCH 3/4] nfs-utils: Fix mem leaks in krb5_util Alice Mitchell
2021-08-06 18:53   ` Olga Kornievskaia

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=e0e036cb4e438fdeb5ed1b8a988dcb170907f012.camel@redhat.com \
    --to=ajmitchell@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