Fix Coverity CID 978183 Resource leak in rexec().

Close the socket if connect() fails to avoid leaking it.

Reported by:	Coverity
CID:		978183
MFC after:	1 week
This commit is contained in:
truckman 2016-05-25 07:26:22 +00:00
parent f3df1825c6
commit 5e2ae27f27

View File

@ -330,6 +330,7 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
goto retry;
}
perror(hp->h_name);
(void) close(s);
return (-1);
}
port = 0;