From owner-svn-src-stable-9@freebsd.org Wed Aug 3 01:26:03 2016 Return-Path: Delivered-To: svn-src-stable-9@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98143BAC125; Wed, 3 Aug 2016 01:26:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7443B14C8; Wed, 3 Aug 2016 01:26:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u731Q2iG018705; Wed, 3 Aug 2016 01:26:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u731Q2Hg018701; Wed, 3 Aug 2016 01:26:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201608030126.u731Q2Hg018701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 3 Aug 2016 01:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r303695 - stable/9/sys/rpc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 01:26:03 -0000 Author: ngie Date: Wed Aug 3 01:26:02 2016 New Revision: 303695 URL: https://svnweb.freebsd.org/changeset/base/303695 Log: MFstable/10 r303692: MFstable/11 r303691: MFC r302550,r302551,r302552,r302553: r302550: Deobfuscate cleanup path in clnt_dg_create(..) Similar to r300836 and r301800, cl and cu will always be non-NULL as they're allocated using the mem_alloc routines, which always use `malloc(..., M_WAITOK)`. Deobfuscating the cleanup path fixes a leak where if cl was NULL and cu was not, cu would not be free'd, and also removes a duplicate test for cl not being NULL. CID: 1007033, 1007344 r302551: Deobfuscate cleanup path in clnt_vc_create(..) Similar to r300836, r301800, and r302550, cl and ct will always be non-NULL as they're allocated using the mem_alloc routines, which always use `malloc(..., M_WAITOK)`. CID: 1007342 r302552: Convert `svc_xprt_alloc(..)` and `svc_xprt_free(..)`'s prototypes to ANSI C style prototypes r302553: Don't test for xpt not being NULL before calling svc_xprt_free(..) svc_xprt_alloc(..) will always return initialized memory as it uses mem_alloc(..) under the covers, which uses malloc(.., M_WAITOK, ..). CID: 1007341 Modified: stable/9/sys/rpc/clnt_dg.c stable/9/sys/rpc/clnt_vc.c stable/9/sys/rpc/svc.c stable/9/sys/rpc/svc_dg.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/rpc/clnt_dg.c ============================================================================== --- stable/9/sys/rpc/clnt_dg.c Wed Aug 3 01:25:44 2016 (r303694) +++ stable/9/sys/rpc/clnt_dg.c Wed Aug 3 01:26:02 2016 (r303695) @@ -313,11 +313,9 @@ recheck_socket: cl->cl_netid = NULL; return (cl); err2: - if (cl) { - mem_free(cl, sizeof (CLIENT)); - if (cu) - mem_free(cu, sizeof (*cu)); - } + mem_free(cl, sizeof (CLIENT)); + mem_free(cu, sizeof (*cu)); + return (NULL); } Modified: stable/9/sys/rpc/clnt_vc.c ============================================================================== --- stable/9/sys/rpc/clnt_vc.c Wed Aug 3 01:25:44 2016 (r303694) +++ stable/9/sys/rpc/clnt_vc.c Wed Aug 3 01:26:02 2016 (r303695) @@ -270,12 +270,10 @@ clnt_vc_create( return (cl); err: - if (ct) { - mtx_destroy(&ct->ct_lock); - mem_free(ct, sizeof (struct ct_data)); - } - if (cl) - mem_free(cl, sizeof (CLIENT)); + mtx_destroy(&ct->ct_lock); + mem_free(ct, sizeof (struct ct_data)); + mem_free(cl, sizeof (CLIENT)); + return ((CLIENT *)NULL); } Modified: stable/9/sys/rpc/svc.c ============================================================================== --- stable/9/sys/rpc/svc.c Wed Aug 3 01:25:44 2016 (r303694) +++ stable/9/sys/rpc/svc.c Wed Aug 3 01:26:02 2016 (r303695) @@ -842,7 +842,7 @@ svcerr_progvers(struct svc_req *rqstp, r * parameters. */ SVCXPRT * -svc_xprt_alloc() +svc_xprt_alloc(void) { SVCXPRT *xprt; SVCXPRT_EXT *ext; @@ -859,8 +859,7 @@ svc_xprt_alloc() * Free a server transport structure. */ void -svc_xprt_free(xprt) - SVCXPRT *xprt; +svc_xprt_free(SVCXPRT *xprt) { mem_free(xprt->xp_p3, sizeof(SVCXPRT_EXT)); Modified: stable/9/sys/rpc/svc_dg.c ============================================================================== --- stable/9/sys/rpc/svc_dg.c Wed Aug 3 01:25:44 2016 (r303694) +++ stable/9/sys/rpc/svc_dg.c Wed Aug 3 01:26:02 2016 (r303695) @@ -142,9 +142,8 @@ svc_dg_create(SVCPOOL *pool, struct sock return (xprt); freedata: (void) printf(svc_dg_str, __no_mem_str); - if (xprt) { - svc_xprt_free(xprt); - } + svc_xprt_free(xprt); + return (NULL); }