Re: [Libtirpc-devel] [PATCH 04/13] clnt_vc.c: resource_leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2018-10-29 at 14:24 +0800, Ian Kent wrote:
> 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@xxxxxxxxxx>
> > ---
> >  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);

Oh!

My bad, reverted in commit e49077d2fa.




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux