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
This commit is contained in:
Enji Cooper 2016-06-10 17:53:28 +00:00
parent 340acf4d09
commit ea85a1540a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301800

View File

@ -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);
}