mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
removed unnecessary allocation
This commit is contained in:
parent
c9badae526
commit
6db1a7baf1
@ -202,16 +202,12 @@ void CNSocket::step() {
|
|||||||
// decrypt readBuffer and copy to CNPacketData
|
// decrypt readBuffer and copy to CNPacketData
|
||||||
CNSocketEncryption::decryptData((uint8_t*)&readBuffer, (uint8_t*)(&EKey), readSize);
|
CNSocketEncryption::decryptData((uint8_t*)&readBuffer, (uint8_t*)(&EKey), readSize);
|
||||||
|
|
||||||
void* tmpBuf = xmalloc(readSize-sizeof(int32_t));
|
void* tmpBuf = readBuffer+sizeof(uint32_t);
|
||||||
memcpy(tmpBuf, readBuffer+sizeof(uint32_t), readSize-sizeof(int32_t));
|
|
||||||
CNPacketData tmp(tmpBuf, *((uint32_t*)readBuffer), readSize-sizeof(int32_t));
|
CNPacketData tmp(tmpBuf, *((uint32_t*)readBuffer), readSize-sizeof(int32_t));
|
||||||
|
|
||||||
// call packet handler!!
|
// call packet handler!!
|
||||||
pHandler(this, &tmp);
|
pHandler(this, &tmp);
|
||||||
|
|
||||||
// clean up the buffer :)
|
|
||||||
free(tmpBuf);
|
|
||||||
|
|
||||||
// reset vars :)
|
// reset vars :)
|
||||||
readSize = 0;
|
readSize = 0;
|
||||||
readBufferIndex = 0;
|
readBufferIndex = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user