1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Disconnect client in case map sending fails

This commit is contained in:
Michał Janiszewski
2016-07-30 10:12:48 +02:00
parent 64c0c594dc
commit 84137738e3

View File

@@ -1024,6 +1024,8 @@ void Network::Server_Send_MAP(NetworkConnection* connection)
header = (unsigned char *)realloc(header, header_len + out_size);
if (header == nullptr) {
log_error("Failed to allocate %u bytes.", header_len + out_size);
connection->SetLastDisconnectReason(STR_MULTIPLAYER_CONNECTION_CLOSED);
connection->Socket->Disconnect();
return;
}
memcpy(&header[header_len], compressed, out_size);
@@ -1035,6 +1037,8 @@ void Network::Server_Send_MAP(NetworkConnection* connection)
header = (unsigned char *)malloc(size);
if (header == nullptr) {
log_error("Failed to allocate %u bytes.", size);
connection->SetLastDisconnectReason(STR_MULTIPLAYER_CONNECTION_CLOSED);
connection->Socket->Disconnect();
return;
}
out_size = size;