Date: Mon, 11 Jul 2016 06:58:24 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302550 - head/sys/rpc Message-ID: <201607110658.u6B6wOhi055529@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Mon Jul 11 06:58:24 2016 New Revision: 302550 URL: https://svnweb.freebsd.org/changeset/base/302550 Log: 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. MFC after: 1 week Reported by: Coverity CID: 1007033, 1007344 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/rpc/clnt_dg.c Modified: head/sys/rpc/clnt_dg.c ============================================================================== --- head/sys/rpc/clnt_dg.c Mon Jul 11 06:55:02 2016 (r302549) +++ head/sys/rpc/clnt_dg.c Mon Jul 11 06:58:24 2016 (r302550) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607110658.u6B6wOhi055529>