Clean up fd on failure. Found by Klocwork

--HG--
extra : convert_revision : 4b999175c8e91ee3ddf283b17525999499a12849
This commit is contained in:
Matt Johnston 2011-04-07 13:25:00 +00:00
parent f924aa18f2
commit 22c16a8b71

View File

@ -50,10 +50,7 @@ static void agentaccept(struct Listener * listener, int sock);
/* Handles client requests to start agent forwarding, sets up listening socket. /* Handles client requests to start agent forwarding, sets up listening socket.
* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
int svr_agentreq(struct ChanSess * chansess) { int svr_agentreq(struct ChanSess * chansess) {
int fd = -1;
int fd;
TRACE(("enter svr_agentreq"))
if (!svr_pubkey_allows_agentfwd()) { if (!svr_pubkey_allows_agentfwd()) {
return DROPBEAR_FAILURE; return DROPBEAR_FAILURE;
@ -91,10 +88,9 @@ int svr_agentreq(struct ChanSess * chansess) {
} }
return DROPBEAR_SUCCESS; return DROPBEAR_SUCCESS;
TRACE(("success"))
fail: fail:
TRACE(("fail")) m_close(fd);
/* cleanup */ /* cleanup */
svr_agentcleanup(chansess); svr_agentcleanup(chansess);