]> git.mxchange.org Git - flightgear.git/commitdiff
Fix another (tiny) memory leak.
authorThorstenB <brehmt@gmail.com>
Mon, 7 Mar 2011 18:34:52 +0000 (19:34 +0100)
committerThorstenB <brehmt@gmail.com>
Mon, 7 Mar 2011 18:38:48 +0000 (19:38 +0100)
SGCloudField::addCloud does *not* keep a reference to SGNewCloud - so we
only need a temporary object. Also adapt to changed addCloud interface
to make things a little more obvious.

src/Environment/fgclouds.cxx

index c66eb7a1094263272ab707abb3f0a33fe983fe78..f5a531382224d8bfa21eecd1698cdc6780f57aa0 100644 (file)
@@ -162,8 +162,8 @@ double FGClouds::buildCloud(SGPropertyNode *cloud_def_root, SGPropertyNode *box_
                                double bottom_shade = cld_def->getDoubleValue("bottom-shade", 1.0);
                                string texture = cld_def->getStringValue("texture", "cu.png");
 
-                               SGNewCloud *cld = 
-                                       new SGNewCloud(type,
+                               SGNewCloud cld = 
+                                       SGNewCloud(type,
                                                texture_root, 
                                                texture, 
                                                min_width, 
@@ -178,7 +178,7 @@ double FGClouds::buildCloud(SGPropertyNode *cloud_def_root, SGPropertyNode *box_
                                                num_sprites,
                                                num_textures_x,
                                                num_textures_y);
-                               layer->addCloud(newpos, cld);
+                               layer->addCloud(newpos, cld.genCloud());
                        }
                }
        }