Fixed potential memory leak

This commit is contained in:
Robert Osfield
2016-07-07 07:16:56 +01:00
parent 6d85404cf0
commit 5ab9a1b420

View File

@@ -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<osg::Geometry*>(morphTarget->getGeometry())) {
osg::ref_ptr<JSONObject> jsonGeometryObject = new JSONObject;
geometry->setPrimitiveSetList(osg::Geometry::PrimitiveSetList()); //delete unused drawArray
jsonGeometryObject->getMaps()["osg.Geometry"] = createJSONGeometry(geometry);
targetList->asArray()->getArray().push_back(jsonGeometryObject);