From owner-svn-src-stable-10@freebsd.org Mon Nov 16 01:09:27 2015 Return-Path: Delivered-To: svn-src-stable-10@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 6E79CA2F0F3; Mon, 16 Nov 2015 01:09:27 +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 4A7A01EA3; Mon, 16 Nov 2015 01:09:27 +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 tAG19QEL074913; Mon, 16 Nov 2015 01:09:26 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAG19Pxr074903; Mon, 16 Nov 2015 01:09:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511160109.tAG19Pxr074903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 16 Nov 2015 01:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r290899 - stable/10/lib/libc/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2015 01:09:27 -0000 Author: ngie Date: Mon Nov 16 01:09:25 2015 New Revision: 290899 URL: https://svnweb.freebsd.org/changeset/base/290899 Log: MFC r290253: Remove unnecessary `if (x)` tests before calling `free(x)`; free(3) already employs this check Sponsored by: EMC / Isilon Storage Division Modified: stable/10/lib/libc/rpc/clnt_bcast.c stable/10/lib/libc/rpc/clnt_vc.c stable/10/lib/libc/rpc/getnetconfig.c stable/10/lib/libc/rpc/mt_misc.c stable/10/lib/libc/rpc/rpc_soc.c stable/10/lib/libc/rpc/rpcb_clnt.c stable/10/lib/libc/rpc/svc.c stable/10/lib/libc/rpc/svc_dg.c stable/10/lib/libc/rpc/svc_simple.c stable/10/lib/libc/rpc/svc_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/rpc/clnt_bcast.c ============================================================================== --- stable/10/lib/libc/rpc/clnt_bcast.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/clnt_bcast.c Mon Nov 16 01:09:25 2015 (r290899) @@ -631,13 +631,10 @@ rpc_broadcast_exp(prog, vers, proc, xarg } /* The giant for loop */ done_broad: - if (inbuf) - (void) free(inbuf); - if (outbuf) - (void) free(outbuf); + free(inbuf); + free(outbuf); #ifdef PORTMAP - if (outbuf_pmap) - (void) free(outbuf_pmap); + free(outbuf_pmap); #endif /* PORTMAP */ for (i = 0; i < fdlistno; i++) { (void)_close(fdlist[i].fd); Modified: stable/10/lib/libc/rpc/clnt_vc.c ============================================================================== --- stable/10/lib/libc/rpc/clnt_vc.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/clnt_vc.c Mon Nov 16 01:09:25 2015 (r290899) @@ -666,8 +666,7 @@ clnt_vc_destroy(cl) (void)_close(ct->ct_fd); } XDR_DESTROY(&(ct->ct_xdrs)); - if (ct->ct_addr.buf) - free(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); Modified: stable/10/lib/libc/rpc/getnetconfig.c ============================================================================== --- stable/10/lib/libc/rpc/getnetconfig.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/getnetconfig.c Mon Nov 16 01:09:25 2015 (r290899) @@ -164,8 +164,7 @@ __nc_error() if ((nc_addr = (int *)thr_getspecific(nc_key)) == NULL) { nc_addr = (int *)malloc(sizeof (int)); if (thr_setspecific(nc_key, (void *) nc_addr) != 0) { - if (nc_addr) - free(nc_addr); + free(nc_addr); return (&nc_error); } *nc_addr = 0; @@ -419,7 +418,7 @@ void *handlep; while (q != NULL) { p = q->next; - if (q->ncp->nc_lookups != NULL) free(q->ncp->nc_lookups); + free(q->ncp->nc_lookups); free(q->ncp); free(q->linep); free(q); @@ -541,8 +540,7 @@ freenetconfigent(netconfigp) { if (netconfigp != NULL) { free(netconfigp->nc_netid); /* holds all netconfigp's strings */ - if (netconfigp->nc_lookups != NULL) - free(netconfigp->nc_lookups); + free(netconfigp->nc_lookups); free(netconfigp); } return; @@ -631,8 +629,7 @@ struct netconfig *ncp; /* where to put r } else { char *cp; /* tmp string */ - if (ncp->nc_lookups != NULL) /* from last visit */ - free(ncp->nc_lookups); + free(ncp->nc_lookups); /* from last visit */ ncp->nc_lookups = NULL; ncp->nc_nlookups = 0; while ((cp = tokenp) != NULL) { Modified: stable/10/lib/libc/rpc/mt_misc.c ============================================================================== --- stable/10/lib/libc/rpc/mt_misc.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/mt_misc.c Mon Nov 16 01:09:25 2015 (r290899) @@ -106,8 +106,7 @@ __rpc_createerr() rce_addr = (struct rpc_createerr *) malloc(sizeof (struct rpc_createerr)); if (thr_setspecific(rce_key, (void *) rce_addr) != 0) { - if (rce_addr) - free(rce_addr); + free(rce_addr); return (&rpc_createerr); } memset(rce_addr, 0, sizeof (struct rpc_createerr)); Modified: stable/10/lib/libc/rpc/rpc_soc.c ============================================================================== --- stable/10/lib/libc/rpc/rpc_soc.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/rpc_soc.c Mon Nov 16 01:09:25 2015 (r290899) @@ -472,8 +472,7 @@ clntunix_create(raddr, prog, vers, sockp if ((raddr->sun_len == 0) || ((svcaddr = malloc(sizeof(struct netbuf))) == NULL ) || ((svcaddr->buf = malloc(sizeof(struct sockaddr_un))) == NULL)) { - if (svcaddr != NULL) - free(svcaddr); + free(svcaddr); rpc_createerr.cf_stat = RPC_SYSTEMERROR; rpc_createerr.cf_error.re_errno = errno; return(cl); Modified: stable/10/lib/libc/rpc/rpcb_clnt.c ============================================================================== --- stable/10/lib/libc/rpc/rpcb_clnt.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/rpcb_clnt.c Mon Nov 16 01:09:25 2015 (r290899) @@ -183,8 +183,7 @@ delete_cache(addr) free(cptr->ac_netid); free(cptr->ac_taddr->buf); free(cptr->ac_taddr); - if (cptr->ac_uaddr) - free(cptr->ac_uaddr); + free(cptr->ac_uaddr); if (prevptr) prevptr->ac_next = cptr->ac_next; else @@ -222,14 +221,10 @@ add_cache(host, netid, taddr, uaddr) ad_cache->ac_taddr->buf = (char *) malloc(taddr->len); if (ad_cache->ac_taddr->buf == NULL) { out: - if (ad_cache->ac_host) - free(ad_cache->ac_host); - if (ad_cache->ac_netid) - free(ad_cache->ac_netid); - if (ad_cache->ac_uaddr) - free(ad_cache->ac_uaddr); - if (ad_cache->ac_taddr) - free(ad_cache->ac_taddr); + free(ad_cache->ac_host); + free(ad_cache->ac_netid); + free(ad_cache->ac_uaddr); + free(ad_cache->ac_taddr); free(ad_cache); return; } @@ -262,8 +257,7 @@ out: free(cptr->ac_netid); free(cptr->ac_taddr->buf); free(cptr->ac_taddr); - if (cptr->ac_uaddr) - free(cptr->ac_uaddr); + free(cptr->ac_uaddr); if (prevptr) { prevptr->ac_next = NULL; @@ -816,10 +810,8 @@ __rpcb_findaddr_timed(program, version, malloc(remote.len)) == NULL)) { rpc_createerr.cf_stat = RPC_SYSTEMERROR; clnt_geterr(client, &rpc_createerr.cf_error); - if (address) { - free(address); - address = NULL; - } + free(address); + address = NULL; goto error; } memcpy(address->buf, remote.buf, remote.len); Modified: stable/10/lib/libc/rpc/svc.c ============================================================================== --- stable/10/lib/libc/rpc/svc.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/svc.c Mon Nov 16 01:09:25 2015 (r290899) @@ -201,8 +201,7 @@ svc_reg(xprt, prog, vers, dispatch, ncon rwlock_wrlock(&svc_lock); if ((s = svc_find(prog, vers, &prev, netid)) != NULL) { - if (netid) - free(netid); + free(netid); if (s->sc_dispatch == dispatch) goto rpcb_it; /* he is registering another xptr */ rwlock_unlock(&svc_lock); @@ -210,8 +209,7 @@ svc_reg(xprt, prog, vers, dispatch, ncon } s = mem_alloc(sizeof (struct svc_callout)); if (s == NULL) { - if (netid) - free(netid); + free(netid); rwlock_unlock(&svc_lock); return (FALSE); } Modified: stable/10/lib/libc/rpc/svc_dg.c ============================================================================== --- stable/10/lib/libc/rpc/svc_dg.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/svc_dg.c Mon Nov 16 01:09:25 2015 (r290899) @@ -421,8 +421,7 @@ svc_dg_destroy(xprt) (void) mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen); if (xprt->xp_ltaddr.buf) (void) mem_free(xprt->xp_ltaddr.buf, xprt->xp_ltaddr.maxlen); - if (xprt->xp_tp) - (void) free(xprt->xp_tp); + free(xprt->xp_tp); svc_xprt_free(xprt); } Modified: stable/10/lib/libc/rpc/svc_simple.c ============================================================================== --- stable/10/lib/libc/rpc/svc_simple.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/svc_simple.c Mon Nov 16 01:09:25 2015 (r290899) @@ -164,10 +164,8 @@ rpc_reg(prognum, versnum, procnum, progn if (((xdrbuf = malloc((unsigned)recvsz)) == NULL) || ((netid = strdup(nconf->nc_netid)) == NULL)) { warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str); - if (xdrbuf != NULL) - free(xdrbuf); - if (netid != NULL) - free(netid); + free(xdrbuf); + free(netid); SVC_DESTROY(svcxprt); break; } Modified: stable/10/lib/libc/rpc/svc_vc.c ============================================================================== --- stable/10/lib/libc/rpc/svc_vc.c Mon Nov 16 00:58:31 2015 (r290898) +++ stable/10/lib/libc/rpc/svc_vc.c Mon Nov 16 01:09:25 2015 (r290899) @@ -408,10 +408,8 @@ __svc_vc_dodestroy(xprt) mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen); if (xprt->xp_ltaddr.buf) mem_free(xprt->xp_ltaddr.buf, xprt->xp_ltaddr.maxlen); - if (xprt->xp_tp) - free(xprt->xp_tp); - if (xprt->xp_netid) - free(xprt->xp_netid); + free(xprt->xp_tp); + free(xprt->xp_netid); svc_xprt_free(xprt); }