public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <steved@redhat.com>
To: Libtirpc-devel Mailing List <libtirpc-devel@lists.sourceforge.net>
Cc: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [Libtirpc-devel] [PATCH 2/2] rpcb_clnt.c: Eliminate double frees in delete_cache()
Date: Mon, 7 Aug 2023 07:16:13 -0400	[thread overview]
Message-ID: <f9ac4cc1-8548-c4d7-ece8-214933a56808@redhat.com> (raw)
In-Reply-To: <20230801144209.557175-2-steved@redhat.com>



On 8/1/23 10:42 AM, Steve Dickson wrote:
> From: Herb Wartens <wartens2@llnl.gov>
> 
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2224666
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed... (tag: libtirpc-1-3-4-rc2)

steved
> ---
>   src/rpcb_clnt.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c
> index c0a9e12..68fe69a 100644
> --- a/src/rpcb_clnt.c
> +++ b/src/rpcb_clnt.c
> @@ -262,12 +262,15 @@ delete_cache(addr)
>   	for (cptr = front; cptr != NULL; cptr = cptr->ac_next) {
>   		if (!memcmp(cptr->ac_taddr->buf, addr->buf, addr->len)) {
>   			/* Unlink from cache. We'll destroy it after releasing the mutex. */
> -			if (cptr->ac_uaddr)
> +			if (cptr->ac_uaddr) {
>   				free(cptr->ac_uaddr);
> -			if (prevptr)
> +				cptr->ac_uaddr = NULL;
> +			}
> +			if (prevptr) {
>   				prevptr->ac_next = cptr->ac_next;
> -			else
> +			} else {
>   				front = cptr->ac_next;
> +			}
>   			cachesize--;
>   			break;
>   		}


  reply	other threads:[~2023-08-07 11:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01 14:42 [PATCH 1/2] rpcb_clnt.c: memory leak in destroy_addr Steve Dickson
2023-08-01 14:42 ` [PATCH 2/2] rpcb_clnt.c: Eliminate double frees in delete_cache() Steve Dickson
2023-08-07 11:16   ` Steve Dickson [this message]
2023-08-07 11:15 ` [Libtirpc-devel] [PATCH 1/2] rpcb_clnt.c: memory leak in destroy_addr 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=f9ac4cc1-8548-c4d7-ece8-214933a56808@redhat.com \
    --to=steved@redhat.com \
    --cc=libtirpc-devel@lists.sourceforge.net \
    --cc=linux-nfs@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox