From 0a7b18ef0f72b4a90b663c0564de632a70d6bc5f Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Fri, 19 Dec 2014 15:11:21 +0100 Subject: [remote-processor] Remove useless new Message::readString was temporally allocating a buffer on the heap (with new). Use variable length arrays to allocate the buffer on the stack. Signed-off-by: Kevin Rocard --- remote-processor/Message.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'remote-processor') diff --git a/remote-processor/Message.cpp b/remote-processor/Message.cpp index ee3652d..8521117 100644 --- a/remote-processor/Message.cpp +++ b/remote-processor/Message.cpp @@ -98,7 +98,7 @@ void CMessage::readString(string& strData) readData(&uiSize, sizeof(uiSize)); // Data - char* pcData = new char[uiSize + 1]; + char pcData[uiSize + 1]; // Content readData(pcData, uiSize); @@ -108,9 +108,6 @@ void CMessage::readString(string& strData) // Output strData = pcData; - - // Delete - delete [] pcData; } uint32_t CMessage::getStringSize(const string& strData) const -- cgit v1.1