From 5ab9a1b4209380b39283f48cebd68e92b28a257b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 7 Jul 2016 07:16:56 +0100 Subject: [PATCH] Fixed potential memory leak --- src/osgPlugins/osgjs/WriteVisitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgPlugins/osgjs/WriteVisitor.cpp b/src/osgPlugins/osgjs/WriteVisitor.cpp index aa6fc29ca..d5bb0b0d7 100644 --- a/src/osgPlugins/osgjs/WriteVisitor.cpp +++ b/src/osgPlugins/osgjs/WriteVisitor.cpp @@ -651,8 +651,8 @@ JSONObject* WriteVisitor::createJSONMorphGeometry(osgAnimation::MorphGeometry* m for(TargetIterator ti = mTargetList.begin(); ti != mTargetList.end(); ti++) { osgAnimation::MorphGeometry::MorphTarget *morphTarget = &(*ti); - JSONObject *jsonGeometryObject = new JSONObject; if(osg::Geometry* geometry = dynamic_cast(morphTarget->getGeometry())) { + osg::ref_ptr jsonGeometryObject = new JSONObject; geometry->setPrimitiveSetList(osg::Geometry::PrimitiveSetList()); //delete unused drawArray jsonGeometryObject->getMaps()["osg.Geometry"] = createJSONGeometry(geometry); targetList->asArray()->getArray().push_back(jsonGeometryObject);