# HG changeset patch # User Matt Johnston # Date 1302182700 0 # Node ID 81def6b732c72a720dc531f4d8d1ba2839e68157 # Parent ae1df0cc3f18c1f6b44a2088804d131fa4f0f565 Clean up fd on failure. Found by Klocwork diff -r ae1df0cc3f18 -r 81def6b732c7 svr-agentfwd.c --- a/svr-agentfwd.c Thu Apr 07 13:24:41 2011 +0000 +++ b/svr-agentfwd.c Thu Apr 07 13:25:00 2011 +0000 @@ -50,10 +50,7 @@ /* Handles client requests to start agent forwarding, sets up listening socket. * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ int svr_agentreq(struct ChanSess * chansess) { - - int fd; - - TRACE(("enter svr_agentreq")) + int fd = -1; if (!svr_pubkey_allows_agentfwd()) { return DROPBEAR_FAILURE; @@ -91,10 +88,9 @@ } return DROPBEAR_SUCCESS; - TRACE(("success")) fail: - TRACE(("fail")) + m_close(fd); /* cleanup */ svr_agentcleanup(chansess);