summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-06-10 17:53:28 +0000
committerngie <ngie@FreeBSD.org>2016-06-10 17:53:28 +0000
commit722a8ee711a61c249c02cd44f266f759c7e63005 (patch)
tree67a58594a653ed4f17a62ff88bbc4730103fb509
parent6ceeb259ecbf2b6c519520e8d3d9a87f25489eaf (diff)
downloadFreeBSD-src-722a8ee711a61c249c02cd44f266f759c7e63005.zip
FreeBSD-src-722a8ee711a61c249c02cd44f266f759c7e63005.tar.gz
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
-rw-r--r--sys/rpc/clnt_bck.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sys/rpc/clnt_bck.c b/sys/rpc/clnt_bck.c
index f1c8dde..66f3c30 100644
--- a/sys/rpc/clnt_bck.c
+++ b/sys/rpc/clnt_bck.c
@@ -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);
}
OpenPOWER on IntegriCloud