From abc68006258cc4f83b480fa05c3243ba201c19e7 Mon Sep 17 00:00:00 2001 From: Mafciejewicz Date: Mon, 30 Aug 2021 00:43:25 +0200 Subject: [PATCH] Fixed memory leak from LoadModelAnimations --- include/ModelAnimation.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/ModelAnimation.hpp b/include/ModelAnimation.hpp index fd24b03..4895a53 100644 --- a/include/ModelAnimation.hpp +++ b/include/ModelAnimation.hpp @@ -39,7 +39,11 @@ class ModelAnimation : public ::ModelAnimation { static std::vector Load(const std::string& fileName) { int count = 0; ::ModelAnimation* modelAnimations = ::LoadModelAnimations(fileName.c_str(), &count); - return std::vector(modelAnimations, modelAnimations + count); + std::vector mats(modelAnimations, modelAnimations + count); + + RL_FREE(modelAnimations); + + return mats; } GETTERSETTER(int, BoneCount, boneCount)