From: Stuart Buchanan Date: Wed, 4 Jul 2012 18:50:20 +0000 (+0100) Subject: Fix a memory leak in random buildings. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4838a9690e1a9492db6741f4950976b63868200d;p=simgear.git Fix a memory leak in random buildings. --- diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index e25e6b13..cc22600a 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -136,7 +136,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, tpath.append(tname); string fullTexPath = SGModelLib::findDataFile(tpath.str(), options); if (fullTexPath.empty()) { - tpath = SGPath("Textures"); + tpath.set("Textures"); tpath.append(tname); fullTexPath = SGModelLib::findDataFile(tpath.str(), options); if (fullTexPath.empty()) { @@ -173,7 +173,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, tpath.append(tname); string fullTexPath = SGModelLib::findDataFile(tpath.str(), options); if (fullTexPath.empty()) { - tpath = SGPath("Textures"); + tpath.set("Textures"); tpath.append(tname); fullTexPath = SGModelLib::findDataFile(tpath.str(), options); if (fullTexPath.empty() ) { @@ -217,7 +217,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, string fullMaskPath = SGModelLib::findDataFile(ompath.str(), options); if (fullMaskPath.empty()) { - ompath = SGPath("Textures"); + ompath.set("Textures"); ompath.append(omname); fullMaskPath = SGModelLib::findDataFile(ompath.str(), options); } @@ -332,7 +332,7 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options, tree_texture = SGModelLib::findDataFile(treePath.str(), options); if (tree_texture.empty()) { - treePath = SGPath("Textures"); + treePath.set("Textures"); treePath.append(treeTexPath); tree_texture = SGModelLib::findDataFile(treePath.str(), options); } diff --git a/simgear/scene/tgdb/SGBuildingBin.cxx b/simgear/scene/tgdb/SGBuildingBin.cxx index fb3b82d9..3000079e 100644 --- a/simgear/scene/tgdb/SGBuildingBin.cxx +++ b/simgear/scene/tgdb/SGBuildingBin.cxx @@ -79,10 +79,10 @@ void addBuildingToLeafGeode(Geode* geode, const SGBuildingBin::Building& buildin // Get or create geometry. osg::ref_ptr geom; - osg::Vec3Array* v = new osg::Vec3Array; - osg::Vec2Array* t = new osg::Vec2Array; - osg::Vec4Array* c = new osg::Vec4Array; // single value - osg::Vec3Array* n = new osg::Vec3Array; + osg::Vec3Array* v; + osg::Vec2Array* t; + osg::Vec4Array* c; + osg::Vec3Array* n; if (geode->getNumDrawables() == 0) { geom = new osg::Geometry;