Skip to content

Commit

Permalink
fix: Fixed exception when reliable window is exhausted and memory man…
Browse files Browse the repository at this point in the history
…ager is trying to dealloc null pointers
  • Loading branch information
TwoTenPvP committed Dec 11, 2019
1 parent e92de94 commit 5a0657b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Ruffles/Messaging/PacketHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ internal static void SendMessage(ArraySegment<byte> payload, Connection connecti
{
connection.SendRaw(new ArraySegment<byte>(((HeapMemory)memoryPointers.Pointers[i]).Buffer, (int)((HeapMemory)memoryPointers.Pointers[i]).VirtualOffset, (int)((HeapMemory)memoryPointers.Pointers[i]).VirtualCount), noDelay, headerSize);
}
}

if (dealloc)
{
// DeAlloc the memory again. This is done for unreliable channels that dont need the message after the initial send.
for (int i = 0; i < memoryPointers.VirtualCount; i++)
if (dealloc)
{
memoryManager.DeAlloc(((HeapMemory)memoryPointers.Pointers[i]));
// DeAlloc the memory again. This is done for unreliable channels that dont need the message after the initial send.
for (int i = 0; i < memoryPointers.VirtualCount; i++)
{
memoryManager.DeAlloc(((HeapMemory)memoryPointers.Pointers[i]));
}
}
}

// Dealloc the array always.
memoryManager.DeAlloc(memoryPointers);
// Dealloc the array always.
memoryManager.DeAlloc(memoryPointers);
}
}
}
}
Expand Down

0 comments on commit 5a0657b

Please sign in to comment.