linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@RedHat.com>
To: Kenneth Dsouza <kdsouza@redhat.com>, linux-nfs@vger.kernel.org
Cc: sorenson@redhat.com
Subject: Re: [PATCH] nfs-utils: Fix minor memory leaks before return.
Date: Mon, 25 Jun 2018 11:37:57 -0400	[thread overview]
Message-ID: <71d23f25-2f6d-21a1-7b31-b85d4eeb7da5@RedHat.com> (raw)
In-Reply-To: <20180620162129.12692-1-kdsouza@redhat.com>



On 06/20/2018 12:21 PM, Kenneth Dsouza wrote:
> Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
> Signed-off-by: Frank Sorenson <sorenson@redhat.com>
> ---
>  support/junction/path.c            | 4 +++-
>  support/nfsidmap/nfsidmap_common.c | 4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
Committed... 

steved.
> 
> diff --git a/support/junction/path.c b/support/junction/path.c
> index 68a1d13..e74e4c4 100644
> --- a/support/junction/path.c
> +++ b/support/junction/path.c
> @@ -326,8 +326,10 @@ nsdb_posix_to_path_array(const char *pathname, char ***path_array)
>  			break;
>  		next = strchrnul(component, '/');
>  		length = (size_t)(next - component);
> -		if (length > 255)
> +		if (length > 255) {
> +			nsdb_free_string_array(result);
>  			return FEDFS_ERR_SVRFAULT;
> +		}
>  
>  		result[i] = strndup(component, length);
>  		if (result[i] == NULL) {
> diff --git a/support/nfsidmap/nfsidmap_common.c b/support/nfsidmap/nfsidmap_common.c
> index 5242c7e..f89b82e 100644
> --- a/support/nfsidmap/nfsidmap_common.c
> +++ b/support/nfsidmap/nfsidmap_common.c
> @@ -57,8 +57,10 @@ struct conf_list *get_local_realms(void)
>  			return NULL;
>  
>  		node->field = calloc(1, NFS4_MAX_DOMAIN_LEN);
> -		if (node->field == NULL)
> +		if (node->field == NULL) {
> +			free(node);
>  			return NULL;
> +		}
>  
>  		nfs4_get_default_domain(NULL, node->field, NFS4_MAX_DOMAIN_LEN);
>  		toupper_str(node->field);
> 

      reply	other threads:[~2018-06-25 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 16:21 [PATCH] nfs-utils: Fix minor memory leaks before return Kenneth Dsouza
2018-06-25 15:37 ` Steve Dickson [this message]

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=71d23f25-2f6d-21a1-7b31-b85d4eeb7da5@RedHat.com \
    --to=steved@redhat.com \
    --cc=kdsouza@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=sorenson@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;
as well as URLs for NNTP newsgroup(s).