Skip to content

Commit 0b430b7

Browse files
Fix: Close socket on error in Openssl_Connect to prevent file descriptor leak.
1 parent d5fcb97 commit 0b430b7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

platform/posix/transport/src/openssl_posix.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,9 @@ OpensslStatus_t Openssl_Connect( NetworkContext_t * pNetworkContext,
694694
if( returnStatus != OPENSSL_SUCCESS )
695695
{
696696
LogError( ( "Failed to establish a TLS connection." ) );
697+
if( socketStatus == SOCKETS_SUCCESS ) {
698+
Sockets_Disconnect( pOpensslParams->socketDescriptor );
699+
}
697700
}
698701
else
699702
{

0 commit comments

Comments
 (0)