Properly free resources in case of error.

CID:		1007032
Found with:	Coverity Prevent(tm)
MFC after:	2 weeks
This commit is contained in:
Christian Brueffer 2014-05-02 20:41:09 +00:00
parent 19e1db1b28
commit 1a2ac459a9

View File

@ -301,15 +301,13 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
return (cl);
err:
if (cl) {
if (ct) {
if (ct->ct_addr.len)
mem_free(ct->ct_addr.buf, ct->ct_addr.len);
mem_free(ct, sizeof (struct ct_data));
}
if (cl)
mem_free(cl, sizeof (CLIENT));
if (ct) {
if (ct->ct_addr.len)
mem_free(ct->ct_addr.buf, ct->ct_addr.len);
mem_free(ct, sizeof (struct ct_data));
}
if (cl)
mem_free(cl, sizeof (CLIENT));
return ((CLIENT *)NULL);
}