Commit b9946d43 authored by Ian Craggs's avatar Ian Craggs

SSL resource cleanup

Bug: 453883
parent ebdea502
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* Ian Craggs, Allan Stockdill-Mander - initial implementation * Ian Craggs, Allan Stockdill-Mander - initial implementation
* Ian Craggs - fix for bug #409702 * Ian Craggs - fix for bug #409702
* Ian Craggs - allow compilation for OpenSSL < 1.0 * Ian Craggs - allow compilation for OpenSSL < 1.0
* Ian Craggs - fix for bug #453883
*******************************************************************************/ *******************************************************************************/
/** /**
...@@ -353,7 +354,6 @@ void SSL_destroy_mutex(ssl_mutex_type* mutex) ...@@ -353,7 +354,6 @@ void SSL_destroy_mutex(ssl_mutex_type* mutex)
rc = CloseHandle(*mutex); rc = CloseHandle(*mutex);
#else #else
rc = pthread_mutex_destroy(mutex); rc = pthread_mutex_destroy(mutex);
free(mutex);
#endif #endif
FUNC_EXIT_RC(rc); FUNC_EXIT_RC(rc);
} }
...@@ -382,10 +382,13 @@ extern unsigned long SSLThread_id(void) ...@@ -382,10 +382,13 @@ extern unsigned long SSLThread_id(void)
extern void SSLLocks_callback(int mode, int n, const char *file, int line) extern void SSLLocks_callback(int mode, int n, const char *file, int line)
{ {
if (sslLocks)
{
if (mode & CRYPTO_LOCK) if (mode & CRYPTO_LOCK)
SSL_lock_mutex(&sslLocks[n]); SSL_lock_mutex(&sslLocks[n]);
else else
SSL_unlock_mutex(&sslLocks[n]); SSL_unlock_mutex(&sslLocks[n]);
}
} }
int SSLSocket_initialize() int SSLSocket_initialize()
...@@ -442,7 +445,18 @@ exit: ...@@ -442,7 +445,18 @@ exit:
void SSLSocket_terminate() void SSLSocket_terminate()
{ {
FUNC_ENTRY; FUNC_ENTRY;
EVP_cleanup();
ERR_free_strings();
if (sslLocks)
{
int i = 0;
for (i = 0; i < CRYPTO_num_locks(); i++)
{
SSL_destroy_mutex(&sslLocks[i]);
}
free(sslLocks); free(sslLocks);
}
FUNC_EXIT; FUNC_EXIT;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment