Fix a file descriptor leak when a socket fails to connect.

[GB.NET]
* BUG: Fix a file descriptor leak when a socket fails to connect.
This commit is contained in:
gambas 2018-10-12 17:12:06 +02:00
parent 3f002896b5
commit 9b73e821ef

View file

@ -164,9 +164,9 @@ static void CSocket_close(CSOCKET *_object)
THIS->DnsTool = NULL;
}
if (SOCKET->status > NET_INACTIVE) /* if it's not connected, does nothing */
fd = SOCKET->socket;
if (fd >= 0)
{
fd = SOCKET->socket;
//fprintf(stderr, "CSocket_close: %p: set fd %d to -1\n", THIS, fd);
SOCKET->socket = -1;