Several SSL/TLS related memory leak fixes.
This commit is contained in:
parent
f55243cf88
commit
1e6d6cd1e7
|
@ -791,7 +791,6 @@ void hub_shutdown_service(struct hub_info* hub)
|
||||||
|
|
||||||
event_queue_shutdown(hub->queue);
|
event_queue_shutdown(hub->queue);
|
||||||
net_con_close(hub->server);
|
net_con_close(hub->server);
|
||||||
hub_free(hub->server);
|
|
||||||
server_alt_port_stop(hub);
|
server_alt_port_stop(hub);
|
||||||
uman_shutdown(hub);
|
uman_shutdown(hub);
|
||||||
hub->status = hub_status_stopped;
|
hub->status = hub_status_stopped;
|
||||||
|
|
|
@ -60,6 +60,7 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
|
||||||
{
|
{
|
||||||
LOG_TRACE("Not TLS connection - closing connection.");
|
LOG_TRACE("Not TLS connection - closing connection.");
|
||||||
}
|
}
|
||||||
|
probe_destroy(probe);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -116,6 +117,8 @@ struct hub_probe* probe_create(struct hub_info* hub, int sd, struct ip_addr_enca
|
||||||
if (probe == NULL)
|
if (probe == NULL)
|
||||||
return NULL; /* OOM */
|
return NULL; /* OOM */
|
||||||
|
|
||||||
|
LOG_TRACE("probe_create(): %p", probe);
|
||||||
|
|
||||||
probe->hub = hub;
|
probe->hub = hub;
|
||||||
probe->connection = net_con_create();
|
probe->connection = net_con_create();
|
||||||
net_con_initialize(probe->connection, sd, probe_net_event, probe, NET_EVENT_READ);
|
net_con_initialize(probe->connection, sd, probe_net_event, probe, NET_EVENT_READ);
|
||||||
|
@ -127,6 +130,7 @@ struct hub_probe* probe_create(struct hub_info* hub, int sd, struct ip_addr_enca
|
||||||
|
|
||||||
void probe_destroy(struct hub_probe* probe)
|
void probe_destroy(struct hub_probe* probe)
|
||||||
{
|
{
|
||||||
|
LOG_TRACE("probe_destroy(): %p (connection=%p)", probe, probe->connection);
|
||||||
if (probe->connection)
|
if (probe->connection)
|
||||||
{
|
{
|
||||||
net_con_close(probe->connection);
|
net_con_close(probe->connection);
|
||||||
|
|
|
@ -71,6 +71,12 @@ void user_destroy(struct hub_user* user)
|
||||||
hub_recvq_destroy(user->recv_queue);
|
hub_recvq_destroy(user->recv_queue);
|
||||||
hub_sendq_destroy(user->send_queue);
|
hub_sendq_destroy(user->send_queue);
|
||||||
|
|
||||||
|
if (user->connection)
|
||||||
|
{
|
||||||
|
LOG_TRACE("user_destory() -> net_con_close(%p)", user->connection);
|
||||||
|
net_con_close(user->connection);
|
||||||
|
}
|
||||||
|
|
||||||
adc_msg_free(user->info);
|
adc_msg_free(user->info);
|
||||||
user_clear_feature_cast_support(user);
|
user_clear_feature_cast_support(user);
|
||||||
hub_free(user);
|
hub_free(user);
|
||||||
|
|
|
@ -179,6 +179,10 @@ void net_con_close(struct net_connection* con)
|
||||||
|
|
||||||
g_backend->handler.con_del(g_backend->data, con);
|
g_backend->handler.con_del(g_backend->data, con);
|
||||||
|
|
||||||
|
#ifdef SSL_SUPPORT
|
||||||
|
SSL_clear(con->ssl);
|
||||||
|
#endif
|
||||||
|
|
||||||
net_close(con->sd);
|
net_close(con->sd);
|
||||||
con->sd = -1;
|
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)
|
void net_cleanup_shutdown(struct net_cleanup_handler* handler)
|
||||||
{
|
{
|
||||||
|
net_cleanup_process(handler);
|
||||||
hub_free(handler->queue);
|
hub_free(handler->queue);
|
||||||
hub_free(handler);
|
hub_free(handler);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ int net_initialize()
|
||||||
LOG_TRACE("Initializing OpenSSL...");
|
LOG_TRACE("Initializing OpenSSL...");
|
||||||
SSL_library_init();
|
SSL_library_init();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
OpenSSL_add_all_algorithms();
|
|
||||||
#endif /* SSL_SUPPORT */
|
#endif /* SSL_SUPPORT */
|
||||||
|
|
||||||
net_initialized = 1;
|
net_initialized = 1;
|
||||||
|
@ -100,7 +99,9 @@ int net_destroy()
|
||||||
net_backend_shutdown();
|
net_backend_shutdown();
|
||||||
|
|
||||||
#ifdef SSL_SUPPORT
|
#ifdef SSL_SUPPORT
|
||||||
/* FIXME: Shutdown OpenSSL here. */
|
ERR_free_strings();
|
||||||
|
EVP_cleanup();
|
||||||
|
CRYPTO_cleanup_all_ex_data();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WINSOCK
|
#ifdef WINSOCK
|
||||||
|
|
Loading…
Reference in New Issue