From 0c1d583ab4608b9f9d7eb85c5ad3b8eacd3bd78f Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Thu, 2 May 2024 19:07:36 -0500 Subject: [PATCH] tests/api.c: fix double close in test_server_loop(). --- tests/api.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/api.c b/tests/api.c index aaa155c8a..e336f6877 100644 --- a/tests/api.c +++ b/tests/api.c @@ -7437,8 +7437,8 @@ done: !defined(WOLFSSL_NO_TLS12) static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args) { - SOCKET_T sockfd = 0; - SOCKET_T clientfd = 0; + SOCKET_T sockfd; + SOCKET_T clientfd = -1; word16 port; callback_functions* cbf; @@ -7601,6 +7601,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_loop(void* args) wolfSSL_shutdown(ssl); wolfSSL_free(ssl); ssl = NULL; CloseSocket(clientfd); + clientfd = -1; count++; } @@ -7618,7 +7619,8 @@ done: if (!sharedCtx) wolfSSL_CTX_free(ctx); - CloseSocket(clientfd); + if (clientfd >= 0) + CloseSocket(clientfd); #ifdef WOLFSSL_TIRTOS fdCloseSession(Task_self());