[v3.6.0] Fix some potential memory issues (#12045)

* Fix deleting IntrusivePtr _pipeline object in Rot.cpp.

* Remove unused code.

* Avoid nullptr dereference in SceneCulling.cpp

* Fix memory leaks for some objective-c code.

* [dragonbones] Avoid extra memory allocation and copy in CCFactory.cpp

* [dragonbones] DragonBonesData::binary needed to be 'freed' rather than 'delete'd.

* [dragonbones] Fix using delete to release memory allocated by 'new[]' in SlotColorTimelineState.

* Remove variable srcOffset & dstOffset in Mesh::merge
This commit is contained in:
James Chen
2022-07-18 16:39:26 +08:00
committed by GitHub
parent 1fd70ef5e7
commit ab733d5644
14 changed files with 34 additions and 45 deletions
@@ -1598,7 +1598,8 @@ DragonBonesData *JSONDataParser::_parseDragonBonesData(const rapidjson::Value &r
const auto l5 = _frameArray.size() * 2;
const auto l6 = _timelineArray.size() * 2;
auto binary = new char[l1 + l2 + l3 + l4 + l5 + l6];
// NOTE: binary is freed in DragonBonesData::_onClear
char* binary = static_cast<char*>(malloc((l1 + l2 + l3 + l4 + l5 + l6) * sizeof(char)));
auto intArray = (int16_t *)binary;
auto floatArray = (float *)(binary + l1);
auto frameIntArray = (int16_t *)(binary + l1 + l2);