- fbx: fix memleak in exception cases.
parent
916947327f
commit
23c62f07f7
|
@ -129,6 +129,7 @@ private:
|
|||
std::vector<aiNode*> nodes;
|
||||
nodes.reserve(conns.size());
|
||||
|
||||
try {
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
|
||||
// ignore object-property links
|
||||
|
@ -138,13 +139,12 @@ private:
|
|||
|
||||
const Object* const object = con->SourceObject();
|
||||
if(!object) {
|
||||
FBXImporter::LogWarn("failed to convert source object for node link");
|
||||
FBXImporter::LogWarn("failed to convert source object for Model link");
|
||||
continue;
|
||||
}
|
||||
|
||||
const Model* const model = dynamic_cast<const Model*>(object);
|
||||
|
||||
|
||||
if(model) {
|
||||
aiNode* nd = new aiNode();
|
||||
nodes.push_back(nd);
|
||||
|
@ -166,6 +166,10 @@ private:
|
|||
std::swap_ranges(nodes.begin(),nodes.end(),parent.mChildren);
|
||||
}
|
||||
}
|
||||
catch(std::exception&) {
|
||||
std::for_each(nodes.begin(),nodes.end(),Util::delete_fun<aiNode>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -173,6 +177,8 @@ private:
|
|||
{
|
||||
const PropertyTable& props = model.Props();
|
||||
|
||||
// XXX this is not complete, need to handle rotation and scaling pivots etc
|
||||
|
||||
bool ok;
|
||||
|
||||
aiVector3D Translation = PropertyGet<aiVector3D>(props,"Lcl Translation",ok);
|
||||
|
@ -640,7 +646,7 @@ private:
|
|||
bones.reserve(sk.Clusters().size());
|
||||
|
||||
const bool no_mat_check = materialIndex == NO_MATERIAL_SEPARATION;
|
||||
ai_assert(!no_mat_check || outputVertStartIndices);
|
||||
ai_assert(no_mat_check || outputVertStartIndices);
|
||||
|
||||
try {
|
||||
|
||||
|
|
Loading…
Reference in New Issue