summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-07-08 20:30:20 +0000
committerngie <ngie@FreeBSD.org>2016-07-08 20:30:20 +0000
commit450eb8400182e87c121f9f0746d9d8fa7f2cb04d (patch)
tree9ba2a709d94b60df45e8337f43930fabfbc5aa90 /sys
parent69867bad8a0afbaff921922b0983698c89dd77fc (diff)
downloadFreeBSD-src-450eb8400182e87c121f9f0746d9d8fa7f2cb04d.zip
FreeBSD-src-450eb8400182e87c121f9f0746d9d8fa7f2cb04d.tar.gz
MFC r301800:
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. CID: 1229999
Diffstat (limited to 'sys')
-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 b63b2b1..78a2078 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