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:
parent
133cfbfa7f
commit
edfc06119a
1 changed files with 5 additions and 5 deletions
|
@ -70,10 +70,6 @@ FGModelMgr::add_model (SGPropertyNode * node)
|
||||||
{
|
{
|
||||||
SG_LOG(SG_GENERAL, SG_INFO,
|
SG_LOG(SG_GENERAL, SG_INFO,
|
||||||
"Adding model " << node->getStringValue("name", "[unnamed]"));
|
"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");
|
const char *path = node->getStringValue("path", "Models/Geometry/glider.ac");
|
||||||
osg::Node *object;
|
osg::Node *object;
|
||||||
|
@ -83,10 +79,14 @@ FGModelMgr::add_model (SGPropertyNode * node)
|
||||||
} catch (const sg_throwable& t) {
|
} catch (const sg_throwable& t) {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n "
|
SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n "
|
||||||
<< t.getFormattedMessage() << t.getOrigin());
|
<< t.getFormattedMessage() << t.getOrigin());
|
||||||
delete instance;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Instance * instance = new Instance;
|
||||||
|
SGModelPlacement *model = new SGModelPlacement;
|
||||||
|
instance->model = model;
|
||||||
|
instance->node = node;
|
||||||
|
|
||||||
model->init( object );
|
model->init( object );
|
||||||
|
|
||||||
// Set position and orientation either
|
// Set position and orientation either
|
||||||
|
|
Loading…
Reference in a new issue