From: ThorstenB Date: Mon, 7 Mar 2011 18:34:52 +0000 (+0100) Subject: Fix another (tiny) memory leak. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4761a3cdcf04771819b3a8de9d018fca20c90ca6;p=flightgear.git Fix another (tiny) memory leak. 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. --- diff --git a/src/Environment/fgclouds.cxx b/src/Environment/fgclouds.cxx index c66eb7a10..f5a531382 100644 --- a/src/Environment/fgclouds.cxx +++ b/src/Environment/fgclouds.cxx @@ -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()); } } }