From 6f7cb6af06a92e9d8404d4cf41f31e5bf67799af Mon Sep 17 00:00:00 2001 From: Mike Samsonov Date: Tue, 19 Nov 2019 16:58:48 +0000 Subject: [PATCH] revert memory leak fix --- code/glTF2/glTF2Asset.inl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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