Skip to content

Commit 0c1d583

Browse files
committed
tests/api.c: fix double close in test_server_loop().
1 parent 51b85ee commit 0c1d583

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tests/api.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7437,8 +7437,8 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args)
74377437
!defined(WOLFSSL_NO_TLS12)
74387438
static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
74397439
{
7440-
SOCKET_T sockfd = 0;
7441-
SOCKET_T clientfd = 0;
7440+
SOCKET_T sockfd;
7441+
SOCKET_T clientfd = -1;
74427442
word16 port;
74437443

74447444
callback_functions* cbf;
@@ -7601,6 +7601,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
76017601
wolfSSL_shutdown(ssl);
76027602
wolfSSL_free(ssl); ssl = NULL;
76037603
CloseSocket(clientfd);
7604+
clientfd = -1;
76047605

76057606
count++;
76067607
}
@@ -7618,7 +7619,8 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args)
76187619
if (!sharedCtx)
76197620
wolfSSL_CTX_free(ctx);
76207621

7621-
CloseSocket(clientfd);
7622+
if (clientfd >= 0)
7623+
CloseSocket(clientfd);
76227624

76237625
#ifdef WOLFSSL_TIRTOS
76247626
fdCloseSession(Task_self());

0 commit comments

Comments
 (0)