Merge branch 'bone-double-free' of https://github.com/DeepARSDK/assimp into DeepARSDK-bone-double-free

pull/5291/head
Kim Kulling 2023-10-21 08:28:02 +02:00
commit 0d187a23c9
1 changed files with 7 additions and 1 deletions

View File

@ -59,6 +59,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/types.h>
#ifdef __cplusplus
#include <unordered_set>
extern "C" {
#endif
@ -872,11 +874,15 @@ struct aiMesh {
// DO NOT REMOVE THIS ADDITIONAL CHECK
if (mNumBones && mBones) {
std::unordered_set<const aiBone *> bones;
for (unsigned int a = 0; a < mNumBones; a++) {
if (mBones[a]) {
delete mBones[a];
bones.insert(mBones[a]);
}
}
for (const aiBone *bone: bones) {
delete bone;
}
delete[] mBones;
}