From: Ian Kent <ikent@redhat.com>
To: Steve Dickson <steved@redhat.com>,
Libtirpc-devel Mailing List
<libtirpc-devel@lists.sourceforge.net>
Cc: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [Libtirpc-devel] [PATCH 04/13] clnt_vc.c: resource_leak
Date: Mon, 29 Oct 2018 14:24:54 +0800 [thread overview]
Message-ID: <08441cd678693753ee63ff40568ddaf2168da637.camel@redhat.com> (raw)
In-Reply-To: <20180907180151.178872-5-steved@redhat.com>
On Fri, 2018-09-07 at 14:01 -0400, Steve Dickson wrote:
> Variable "ct" going out of scope leaks the storage it points to.
>
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
> src/clnt_vc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/clnt_vc.c b/src/clnt_vc.c
> index 3d775c7..10ee91a 100644
> --- a/src/clnt_vc.c
> +++ b/src/clnt_vc.c
> @@ -325,6 +325,8 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
> recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz);
> xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz,
> cl->cl_private, read_vc, write_vc);
> + mem_free(ct->ct_addr.buf, ct->ct_addr.len);
> + mem_free(ct, sizeof (struct ct_data));
> return (cl);
>
> err:
Are you sure about this one Steve?
aka:
/*
* Create a client handle which uses xdrrec for serialization
* and authnone for authentication.
*/
cl->cl_ops = clnt_vc_ops();
cl->cl_private = ct; <------?
cl->cl_auth = authnone_create();
sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz);
recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz);
xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz,
cl->cl_private, read_vc, write_vc);
return (cl);
next prev parent reply other threads:[~2018-10-29 6:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-07 18:01 [PATCH 00/13] libtirpc: Closed a number of memory leaks Steve Dickson
2018-09-07 18:01 ` [PATCH 01/13] auth_gss.c: resource_leak Steve Dickson
2018-09-07 18:01 ` [PATCH 02/13] auth_gss.c: buffer_size_warning Steve Dickson
2018-09-07 18:01 ` [PATCH 03/13] clnt_bcast.c: resource_leak Steve Dickson
2018-09-07 18:01 ` [PATCH 04/13] clnt_vc.c: resource_leak Steve Dickson
2018-10-29 6:24 ` Ian Kent [this message]
2018-10-29 6:29 ` [Libtirpc-devel] " Ian Kent
2018-09-07 18:01 ` [PATCH 05/13] getnetconfig.c: cppcheck_warning Steve Dickson
2018-09-07 18:01 ` [PATCH 06/13] getnetpath.c: resource_leak Steve Dickson
2018-09-07 18:01 ` [PATCH 07/13] rpc_generic.c: resource_leak Steve Dickson
2018-09-07 18:01 ` [PATCH 08/13] rpc_soc.c: resource_leak Steve Dickson
2018-09-07 18:01 ` [PATCH 09/13] rpc_soc.c: buffer_size_warning Steve Dickson
2018-09-07 18:01 ` [PATCH 10/13] rpcb_clnt.c: resource_leak Steve Dickson
2018-09-07 18:01 ` [PATCH 11/13] rtime.c: resource_leak Steve Dickson
2018-09-07 18:01 ` [PATCH 12/13] svc_generic.c: resource_leak Steve Dickson
2018-09-07 18:01 ` [PATCH 13/13] svc_simple.c: resource_leak Steve Dickson
2018-09-11 16:00 ` [PATCH 00/13] libtirpc: Closed a number of memory leaks 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=08441cd678693753ee63ff40568ddaf2168da637.camel@redhat.com \
--to=ikent@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).