From 81b81556436d409b8a803f30564639192ca9f3ec Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Thu, 18 Aug 2022 12:07:03 -0500 Subject: [PATCH] Fix server-threaded to release ECC cache --- tls/server-tls-threaded.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tls/server-tls-threaded.c b/tls/server-tls-threaded.c index 491b33cb..edc3f700 100644 --- a/tls/server-tls-threaded.c +++ b/tls/server-tls-threaded.c @@ -1,6 +1,6 @@ /* server-tls-threaded.c * - * Copyright (C) 2006-2020 wolfSSL Inc. + * Copyright (C) 2006-2022 wolfSSL Inc. * * This file is part of wolfSSL. (formerly known as CyaSSL) * @@ -115,7 +115,7 @@ void* ClientHandler(void* args) wolfSSL_free(ssl); /* Free the wolfSSL object */ close(pkg->connd); /* Close the connection to the server */ pkg->open = 1; /* Indicate that execution is over */ - pthread_exit(NULL); /* End theread execution */ + pthread_exit(NULL); /* End thread execution */ } /* Check for server shutdown command */ @@ -147,7 +147,10 @@ void* ClientHandler(void* args) wolfSSL_free(ssl); /* Free the wolfSSL object */ close(pkg->connd); /* Close the connection to the server */ pkg->open = 1; /* Indicate that execution is over */ - pthread_exit(NULL); /* End theread execution */ +#if defined(HAVE_ECC) && defined(FP_ECC) + wc_ecc_fp_free(); /* free per thread cache */ +#endif + pthread_exit(NULL); /* End thread execution */ } @@ -245,7 +248,7 @@ int main() - /* initialise thread array */ + /* Initialize thread array */ for (i = 0; i < MAX_CONCURRENT_THREADS; ++i) { printf("Creating %d thread\n", i); thread[i].open = 1; @@ -274,7 +277,7 @@ int main() - /* Fill out the relevent thread argument package information */ + /* Fill out the relevant thread argument package information */ thread[i].open = 0; thread[i].connd = connd;