Date: Tue, 16 Oct 2012 09:36:54 -0400 (EDT) From: Rick Macklem <rmacklem@uoguelph.ca> To: "Pedro F. Giffuni" <pfg@FreeBSD.org> Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r241601 - in stable/9: lib/libc/rpc sys/rpc Message-ID: <765985284.2313601.1350394614176.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <201210160137.q9G1bIWm016746@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Pedro F. Giffuni wrote: > Author: pfg > Date: Tue Oct 16 01:37:17 2012 > New Revision: 241601 > URL: http://svn.freebsd.org/changeset/base/241601 > > Log: > MFC r241143: > > rpc: be sure to free cl_netid and cl_tp. > > When creating a client with clnt_tli_create, it uses strdup to copy > strings for these fields if nconf is passed in. clnt_dg_destroy frees > these strings already. Make sure clnt_vc_destroy frees them in the > same > way. > I think the patch is fine. However, just fyi, there is no clnt_tli_create() in the kernel and nothing in the kernel currently sets cl_netid or cl_tp non-NULL, as far as I can see. rick > Tested by: David Wolfskill > Obtained from: Bull GNU/Linux NFSv4 Project (libtirpc) > > Modified: > stable/9/lib/libc/rpc/clnt_vc.c > stable/9/sys/rpc/clnt_vc.c > > Modified: stable/9/lib/libc/rpc/clnt_vc.c > ============================================================================== > --- stable/9/lib/libc/rpc/clnt_vc.c Tue Oct 16 01:10:43 2012 (r241600) > +++ stable/9/lib/libc/rpc/clnt_vc.c Tue Oct 16 01:37:17 2012 (r241601) > @@ -672,6 +672,10 @@ clnt_vc_destroy(cl) > if (ct->ct_addr.buf) > free(ct->ct_addr.buf); > mem_free(ct, sizeof(struct ct_data)); > + if (cl->cl_netid && cl->cl_netid[0]) > + mem_free(cl->cl_netid, strlen(cl->cl_netid) +1); > + if (cl->cl_tp && cl->cl_tp[0]) > + mem_free(cl->cl_tp, strlen(cl->cl_tp) +1); > mem_free(cl, sizeof(CLIENT)); > mutex_unlock(&clnt_fd_lock); > thr_sigsetmask(SIG_SETMASK, &(mask), NULL); > > Modified: stable/9/sys/rpc/clnt_vc.c > ============================================================================== > --- stable/9/sys/rpc/clnt_vc.c Tue Oct 16 01:10:43 2012 (r241600) > +++ stable/9/sys/rpc/clnt_vc.c Tue Oct 16 01:37:17 2012 (r241601) > @@ -836,6 +836,10 @@ clnt_vc_destroy(CLIENT *cl) > soclose(so); > } > mem_free(ct, sizeof(struct ct_data)); > + if (cl->cl_netid && cl->cl_netid[0]) > + mem_free(cl->cl_netid, strlen(cl->cl_netid) +1); > + if (cl->cl_tp && cl->cl_tp[0]) > + mem_free(cl->cl_tp, strlen(cl->cl_tp) +1); > mem_free(cl, sizeof(CLIENT)); > }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?765985284.2313601.1350394614176.JavaMail.root>