1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-30 11:26:38 +02:00

Fix memory leak when an outgoing TLS_connect() fails.

Reported by immibis in https://bugs.unrealircd.org/view.php?id=6263
This commit is contained in:
Bram Matthys
2023-04-22 14:36:21 +02:00
parent 2922a8ae5a
commit f467c031c1
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -113,6 +113,7 @@ HELPOP updates, fixes for streaming logs over websockets, ban exemption change a
* Crash if there is a parse error in an included file and there are
other remote included files still being downloaded.
* Memory leak in WHOWAS
* Memory leak when connecting to a TLS server fails
* Workaround a bug in some websocket implementations where the WSOP_PONG
frame is unmasked (now permitted).
+7
View File
@@ -692,7 +692,14 @@ void unreal_tls_client_handshake(int fd, int revents, void *data)
switch (unreal_tls_connect(client, fd))
{
case -1:
SSL_set_shutdown(client->local->ssl, SSL_RECEIVED_SHUTDOWN);
SSL_smart_shutdown(client->local->ssl);
SSL_free(client->local->ssl);
client->local->ssl = NULL;
ClearTLS(client);
SetDeadSocket(client);
fd_close(fd);
fd_unnotify(fd);
client->local->fd = -1;
--OpenFiles;
return;