From aebc6b4c1e047e8d864e961777b1d23a7c756b1a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 11 Jul 2017 00:31:19 +0300 Subject: Fix memory leak in BeingRecv::processBeingMove3, if player not totally visible. --- src/net/ea/beingrecv.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index fcb3871f8..bf7ae32ba 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -428,13 +428,15 @@ void BeingRecv::processBeingMove3(Net::MessageIn &msg) const int len = msg.readInt16("len") - 14; Being *const dstBeing = actorManager->findBeing( msg.readBeingId("being id")); - if ((dstBeing == nullptr) || dstBeing == localPlayer) + if (dstBeing == nullptr || + dstBeing == localPlayer) { DEBUGLOGSTR("invisible player?"); msg.readInt16("speed"); msg.readInt16("x"); msg.readInt16("y"); - msg.readBytes(len, "moving path"); + unsigned char *bytes = msg.readBytes(len, "moving path"); + delete [] bytes; BLOCK_END("BeingRecv::processBeingMove3") return; } -- cgit v1.2.3-70-g09d2