Date: Fri, 10 Jun 2016 17:53:28 +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: r301800 - head/sys/rpc Message-ID: <201606101753.u5AHrSBo018274@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Fri Jun 10 17:53:28 2016 New Revision: 301800 URL: https://svnweb.freebsd.org/changeset/base/301800 Log: Deobfuscate cleanup path in clnt_bck_create(..) Similar to r300836, cl and ct 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 ct was not, ct would not be free'd, and also removes a duplicate test for cl not being NULL. Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D6801 MFC after: 1 week Reported by: Coverity CID: 1229999 Reviewed by: cem Sponsored by: EMC / Isilon Storage Division Modified: head/sys/rpc/clnt_bck.c Modified: head/sys/rpc/clnt_bck.c ============================================================================== --- head/sys/rpc/clnt_bck.c Fri Jun 10 15:47:20 2016 (r301799) +++ head/sys/rpc/clnt_bck.c Fri Jun 10 17:53:28 2016 (r301800) @@ -175,14 +175,9 @@ clnt_bck_create( return (cl); err: - if (cl) { - 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 (NULL); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606101753.u5AHrSBo018274>