From 6db1a7baf1709f0a30e4f2ca5c79f86180626709 Mon Sep 17 00:00:00 2001 From: CPunch Date: Wed, 26 Aug 2020 14:23:40 -0500 Subject: [PATCH] removed unnecessary allocation --- src/CNProtocol.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/CNProtocol.cpp b/src/CNProtocol.cpp index b2c4acf..1c8c1a1 100644 --- a/src/CNProtocol.cpp +++ b/src/CNProtocol.cpp @@ -202,16 +202,12 @@ void CNSocket::step() { // decrypt readBuffer and copy to CNPacketData CNSocketEncryption::decryptData((uint8_t*)&readBuffer, (uint8_t*)(&EKey), readSize); - void* tmpBuf = xmalloc(readSize-sizeof(int32_t)); - memcpy(tmpBuf, readBuffer+sizeof(uint32_t), readSize-sizeof(int32_t)); + void* tmpBuf = readBuffer+sizeof(uint32_t); CNPacketData tmp(tmpBuf, *((uint32_t*)readBuffer), readSize-sizeof(int32_t)); // call packet handler!! pHandler(this, &tmp); - // clean up the buffer :) - free(tmpBuf); - // reset vars :) readSize = 0; readBufferIndex = 0;