fix: memory leak if send queue is full

This commit is contained in:
Robin C. Ladiges 2024-05-16 21:46:05 +02:00
parent ad79fe1732
commit 1b3d763015
No known key found for this signature in database
GPG Key ID: B494D3DF92661B99
1 changed files with 3 additions and 4 deletions

View File

@ -541,10 +541,9 @@ void SocketClient::recvFunc() {
}
bool SocketClient::queuePacket(Packet* packet) {
if (socket_log_state == SOCKET_LOG_CONNECTED && mPacketQueueOpen) {
mSendQueue.push((s64)packet,
sead::MessageQueue::BlockType::NonBlocking); // as this is non-blocking, it
// will always return true.
if (socket_log_state == SOCKET_LOG_CONNECTED && mPacketQueueOpen && !mSendQueue.isFull()) {
// as this is non-blocking, it will always return true.
mSendQueue.push((s64)packet, sead::MessageQueue::BlockType::NonBlocking);
return true;
} else {
mHeap->free(packet);