mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
[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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user