diff --git a/code/glTF2/glTF2Asset.inl b/code/glTF2/glTF2Asset.inl index 3c98a8150..6b47b1607 100644 --- a/code/glTF2/glTF2Asset.inl +++ b/code/glTF2/glTF2Asset.inl @@ -270,14 +270,13 @@ Ref LazyDict::Retrieve(unsigned int i) throw DeadlyImportError("GLTF: Object at index \"" + to_string(i) + "\" is not a JSON object"); } - // In case Read method throws an exception this will not leak - auto inst = std::make_unique(); + T* inst = new T(); inst->id = std::string(mDictId) + "_" + to_string(i); inst->oIndex = i; ReadMember(obj, "name", inst->name); inst->Read(obj, mAsset); - return Add(inst.release()); + return Add(inst); } template