mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Close socket when listening fails.
This commit is contained in:
parent
5437976e65
commit
1f3dc927c0
@ -336,8 +336,8 @@ bool ListenSocket::Listen( int port, int backlog )
|
|||||||
int val = 1;
|
int val = 1;
|
||||||
setsockopt( m_sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof( val ) );
|
setsockopt( m_sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof( val ) );
|
||||||
#endif
|
#endif
|
||||||
if( bind( m_sock, res->ai_addr, res->ai_addrlen ) == -1 ) { freeaddrinfo( res ); return false; }
|
if( bind( m_sock, res->ai_addr, res->ai_addrlen ) == -1 ) { freeaddrinfo( res ); Close(); return false; }
|
||||||
if( listen( m_sock, backlog ) == -1 ) { freeaddrinfo( res ); return false; }
|
if( listen( m_sock, backlog ) == -1 ) { freeaddrinfo( res ); Close(); return false; }
|
||||||
freeaddrinfo( res );
|
freeaddrinfo( res );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user