From c06bb13b2094932a2b1663f1d49019f24d94af0f Mon Sep 17 00:00:00 2001 From: flyhex <68577398+flyhex@users.noreply.github.com> Date: Sat, 13 Aug 2022 11:43:02 +0800 Subject: [PATCH] Update CCQuadCommand.cpp //bugfix memory leak problem of __indices --- cocos/renderer/CCQuadCommand.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos/renderer/CCQuadCommand.cpp b/cocos/renderer/CCQuadCommand.cpp index 286093b50f27..55cdfddddca5 100644 --- a/cocos/renderer/CCQuadCommand.cpp +++ b/cocos/renderer/CCQuadCommand.cpp @@ -68,8 +68,9 @@ void QuadCommand::reIndex(int indicesCount) CCLOG("cocos2d: QuadCommand: resizing index size from [%d] to [%d]", __indexCapacity, indicesCount); - _ownedIndices.push_back(__indices); + //bugfix memory leak problem of __indices __indices = new (std::nothrow) uint16_t[indicesCount]; + _ownedIndices.push_back(__indices); __indexCapacity = indicesCount; }