diff --git a/src/common/common.c b/src/common/common.c index 011f35cac9..ceb1bf38b5 100644 --- a/src/common/common.c +++ b/src/common/common.c @@ -24,6 +24,7 @@ #if defined(OQS_USE_OPENSSL) #include #include "ossl_helpers.h" +CRYPTO_ONCE OQS_ONCE_STATIC_FREE; #endif /* Identifying the CPU is expensive so we cache the results in cpu_ext_data */ @@ -216,7 +217,7 @@ OQS_API const char *OQS_version(void) { OQS_API void OQS_destroy(void) { #if defined(OQS_USE_OPENSSL) - oqs_free_ossl_objects(); + CRYPTO_THREAD_run_once(&OQS_ONCE_STATIC_FREE, oqs_free_ossl_objects); #endif return; }