diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 5a3a7ac59..8d0c73bff 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -239,7 +239,7 @@ UVController::UVController(const UVController& copy, const osg::CopyOp& copyop) void UVController::setDefaults(osg::StateSet *stateset) { - osg::TexMat* texMat = new osg::TexMat; + osg::ref_ptr texMat (new osg::TexMat); for (std::set::const_iterator it = mTextureUnits.begin(); it != mTextureUnits.end(); ++it) stateset->setTextureAttributeAndModes(*it, texMat, osg::StateAttribute::ON); }