1
0
Fork 0

Not reported by cppcheck: fix another memory leak :)

Extends/changes commit 687be04678
to fix a related second leak (with "model").
This commit is contained in:
ThorstenB 2011-02-04 19:38:22 +01:00
parent 133cfbfa7f
commit edfc06119a

View file

@ -70,10 +70,6 @@ FGModelMgr::add_model (SGPropertyNode * node)
{
SG_LOG(SG_GENERAL, SG_INFO,
"Adding model " << node->getStringValue("name", "[unnamed]"));
Instance * instance = new Instance;
SGModelPlacement *model = new SGModelPlacement;
instance->model = model;
instance->node = node;
const char *path = node->getStringValue("path", "Models/Geometry/glider.ac");
osg::Node *object;
@ -83,10 +79,14 @@ FGModelMgr::add_model (SGPropertyNode * node)
} catch (const sg_throwable& t) {
SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n "
<< t.getFormattedMessage() << t.getOrigin());
delete instance;
return;
}
Instance * instance = new Instance;
SGModelPlacement *model = new SGModelPlacement;
instance->model = model;
instance->node = node;
model->init( object );
// Set position and orientation either