Several SSL/TLS related memory leak fixes.

This commit is contained in:
Jan Vidar Krey
2010-08-24 22:58:10 +02:00
parent 3ccce614d0
commit 3353049ae3
5 changed files with 29 additions and 3 deletions

View File

@@ -179,6 +179,10 @@ void net_con_close(struct net_connection* con)
g_backend->handler.con_del(g_backend->data, con);
#ifdef SSL_SUPPORT
SSL_clear(con->ssl);
#endif
net_close(con->sd);
con->sd = -1;
@@ -196,6 +200,7 @@ struct net_cleanup_handler* net_cleanup_initialize(size_t max)
void net_cleanup_shutdown(struct net_cleanup_handler* handler)
{
net_cleanup_process(handler);
hub_free(handler->queue);
hub_free(handler);
}

View File

@@ -62,7 +62,6 @@ int net_initialize()
LOG_TRACE("Initializing OpenSSL...");
SSL_library_init();
SSL_load_error_strings();
OpenSSL_add_all_algorithms();
#endif /* SSL_SUPPORT */
net_initialized = 1;
@@ -101,7 +100,9 @@ int net_destroy()
net_backend_shutdown();
#ifdef SSL_SUPPORT
/* FIXME: Shutdown OpenSSL here. */
ERR_free_strings();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
#endif
#ifdef WINSOCK