Close socket if TCP connecting fails to avoid leaking sockets
authorPekka Riikonen <priikone@silcnet.org>
Mon, 9 Jun 2008 05:26:01 +0000 (08:26 +0300)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 9 Jun 2008 05:26:01 +0000 (08:26 +0300)
lib/silcutil/unix/silcunixnet.c

index daf9e1837a70dcf231e24002da1794df70452b20..2332672d4643d125180f7923315020246153c51c 100644 (file)
@@ -701,6 +701,9 @@ SILC_FSM_STATE(silc_net_connect_st_finish)
       silc_async_free(conn->op);
   }
 
+  if (conn->sock && conn->status != SILC_NET_OK)
+    silc_net_close_connection(conn->sock);
+
   return SILC_FSM_FINISH;
 }