diff --git a/c/src/point_one/polaris/polaris.c b/c/src/point_one/polaris/polaris.c index 65083e4..58d766f 100644 --- a/c/src/point_one/polaris/polaris.c +++ b/c/src/point_one/polaris/polaris.c @@ -387,7 +387,7 @@ void Polaris_Disconnect(PolarisContext_t* context) { P1_DebugPrint("Closing Polaris connection.\n"); context->disconnected = 1; #ifdef POLARIS_USE_TLS - if (pthread_mutex_init(&context->context_lock, NULL) != 0){ + if (pthread_mutex_init(&context->context_lock, NULL) == 0){ SSL_shutdown(context->ssl); pthread_mutex_destroy(&context->context_lock); } @@ -885,7 +885,7 @@ static int OpenSocket(PolarisContext_t* context, const char* endpoint_url, void CloseSocket(PolarisContext_t* context, int destroy_context) { #ifdef POLARIS_USE_TLS if (destroy_context && context->ssl != NULL) { - if (pthread_mutex_init(&context->context_lock, NULL) != 0){ + if (pthread_mutex_init(&context->context_lock, NULL) == 0){ if (SSL_get_shutdown(context->ssl) == 0) { SSL_shutdown(context->ssl); }