Fixed Coverity issue.

CID 12328: Resource leak (RESOURCE_LEAK)
Calling allocation function "osg::KdTree::cloneType() const". (The virtual call resolves to "osg::Object * osg::KdTree::cloneType() const".) [show details]
Failing to save storage allocated by "this->_kdTreePrototype->cloneType()" leaks it.
This commit is contained in:
Robert Osfield
2011-05-24 10:19:22 +00:00
parent e7ee4c1f79
commit 6ce53fb7b0

View File

@@ -812,7 +812,8 @@ void KdTreeBuilder::apply(osg::Geode& geode)
osg::KdTree* previous = dynamic_cast<osg::KdTree*>(geom->getShape());
if (previous) continue;
osg::ref_ptr<osg::KdTree> kdTree = dynamic_cast<osg::KdTree*>(_kdTreePrototype->cloneType());
osg::ref_ptr<osg::Object> obj = _kdTreePrototype->cloneType();
osg::ref_ptr<osg::KdTree> kdTree = dynamic_cast<osg::KdTree*>(obj.get());
if (kdTree->build(_buildOptions, geom))
{