]> git.mxchange.org Git - simgear.git/commitdiff
Fix a memory leak in random buildings.
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Wed, 4 Jul 2012 18:50:20 +0000 (19:50 +0100)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Wed, 4 Jul 2012 18:50:20 +0000 (19:50 +0100)
simgear/scene/material/mat.cxx
simgear/scene/tgdb/SGBuildingBin.cxx

index e25e6b137cac169ecb00ebe47efc845a0e43a303..cc22600a8e80661c0746d35bfa7300d3ea7f9c6c 100644 (file)
@@ -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);
             }
index fb3b82d996d1759553267b96ccb150236778ddaf..3000079e52f577a62e4c60ae509a8e4149a1fde7 100644 (file)
@@ -79,10 +79,10 @@ void addBuildingToLeafGeode(Geode* geode, const SGBuildingBin::Building& buildin
       
       // Get or create geometry.
       osg::ref_ptr<osg::Geometry> 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;