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
This commit is contained in:
Enji Cooper 2016-07-11 06:58:24 +00:00
parent 47a3ee5c60
commit f99529597c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302550

View File

@ -313,11 +313,9 @@ clnt_dg_create(
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);
}