From owner-svn-src-head@FreeBSD.ORG Tue Oct 2 19:10:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 632CB106566B; Tue, 2 Oct 2012 19:10:20 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EACA8FC08; Tue, 2 Oct 2012 19:10:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q92JAKEx089967; Tue, 2 Oct 2012 19:10:20 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q92JAKAL089964; Tue, 2 Oct 2012 19:10:20 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201210021910.q92JAKAL089964@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 2 Oct 2012 19:10:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241143 - in head: lib/libc/rpc sys/rpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2012 19:10:20 -0000 Author: pfg Date: Tue Oct 2 19:10:19 2012 New Revision: 241143 URL: http://svn.freebsd.org/changeset/base/241143 Log: libtirpc: 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. This change matches the reference (OpenSolaris) implementation. Tested by: David Wolfskill Obtained from: Bull GNU/Linux NFSv4 Project (libtirpc) MFC after: 2 weeks Modified: head/lib/libc/rpc/clnt_vc.c head/sys/rpc/clnt_vc.c Modified: head/lib/libc/rpc/clnt_vc.c ============================================================================== --- head/lib/libc/rpc/clnt_vc.c Tue Oct 2 19:03:21 2012 (r241142) +++ head/lib/libc/rpc/clnt_vc.c Tue Oct 2 19:10:19 2012 (r241143) @@ -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: head/sys/rpc/clnt_vc.c ============================================================================== --- head/sys/rpc/clnt_vc.c Tue Oct 2 19:03:21 2012 (r241142) +++ head/sys/rpc/clnt_vc.c Tue Oct 2 19:10:19 2012 (r241143) @@ -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)); }