mirror of https://github.com/OpenTTD/OpenTTD.git
Fix ef991b17: server was trying to free() a packet created with "new CommandPacket()" (#9334)
This commit is contained in:
parent
feb2ddbefa
commit
5e44da3010
|
@ -1072,7 +1072,7 @@ void NetworkGameLoop()
|
||||||
if (cp != nullptr) {
|
if (cp != nullptr) {
|
||||||
NetworkSendCommand(cp->tile, cp->p1, cp->p2, cp->cmd & ~CMD_FLAGS_MASK, nullptr, cp->text, cp->company);
|
NetworkSendCommand(cp->tile, cp->p1, cp->p2, cp->cmd & ~CMD_FLAGS_MASK, nullptr, cp->text, cp->company);
|
||||||
DEBUG(desync, 0, "Injecting: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text.c_str(), GetCommandName(cp->cmd));
|
DEBUG(desync, 0, "Injecting: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text.c_str(), GetCommandName(cp->cmd));
|
||||||
free(cp);
|
delete cp;
|
||||||
cp = nullptr;
|
cp = nullptr;
|
||||||
}
|
}
|
||||||
if (check_sync_state) {
|
if (check_sync_state) {
|
||||||
|
|
|
@ -1758,7 +1758,7 @@ static void NetworkHandleCommandQueue(NetworkClientSocket *cs)
|
||||||
CommandPacket *cp;
|
CommandPacket *cp;
|
||||||
while ((cp = cs->outgoing_queue.Pop()) != nullptr) {
|
while ((cp = cs->outgoing_queue.Pop()) != nullptr) {
|
||||||
cs->SendCommand(cp);
|
cs->SendCommand(cp);
|
||||||
free(cp);
|
delete cp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue