Fix coverity findings.

pull/1077/head
Kim Kulling 2016-11-22 22:03:31 +01:00
parent 61e974f767
commit ba2f377b52
4 changed files with 25 additions and 6 deletions

View File

@ -451,6 +451,7 @@ void ObjFileParser::getFace( aiPrimitiveType type ) {
DefaultLogger::get()->error("Obj: Ignoring empty face");
// skip line and clean up
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
delete face;
return;
}

View File

@ -1480,10 +1480,11 @@ void X3DImporter::ParseNode_Head()
XML_CheckNode_MustBeEmpty();
// adding metadata from <head> as MetaString from <Scene>
bool added( false );
CX3DImporter_NodeElement_MetaString* ms = new CX3DImporter_NodeElement_MetaString(NodeElement_Cur);
ms->Name = mReader->getAttributeValueSafe("name");
// name can not be empty
// name must not be empty
if(!ms->Name.empty())
{
ms->Value.push_back(mReader->getAttributeValueSafe("content"));
@ -1491,8 +1492,13 @@ void X3DImporter::ParseNode_Head()
if ( NodeElement_Cur != nullptr )
{
NodeElement_Cur->Child.push_back( ms );
added = true;
}
}
// if an error has occurred, release instance
if ( !added ) {
delete ms;
}
}// if(XML_CheckNode_NameEqual("meta"))
}// if(mReader->getNodeType() == irr::io::EXN_ELEMENT)
else if(mReader->getNodeType() == irr::io::EXN_ELEMENT_END)

View File

@ -488,6 +488,9 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
if ( vertexWeightAccessor ) {
p.attributes.weight.push_back( vertexWeightAccessor );
}
delete[] jointsPerVertex;
delete[] vertexWeightData;
delete[] vertexJointData;
}
void glTFExporter::ExportMeshes()
@ -867,7 +870,10 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
}
Ref<Accessor> tranAccessor = ExportData(mAsset, animId, buffer, nodeChannel->mNumPositionKeys, translationData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
if (tranAccessor) animRef->Parameters.translation = tranAccessor;
if ( tranAccessor ) {
animRef->Parameters.translation = tranAccessor;
}
delete[] translationData;
}
//-------------------------------------------------------
@ -879,7 +885,10 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
}
Ref<Accessor> scaleAccessor = ExportData(mAsset, animId, buffer, nodeChannel->mNumScalingKeys, scaleData, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
if (scaleAccessor) animRef->Parameters.scale = scaleAccessor;
if ( scaleAccessor ) {
animRef->Parameters.scale = scaleAccessor;
}
delete[] scaleData;
}
//-------------------------------------------------------
@ -894,7 +903,10 @@ inline void ExtractAnimationData(Asset& mAsset, std::string& animId, Ref<Animati
}
Ref<Accessor> rotAccessor = ExportData(mAsset, animId, buffer, nodeChannel->mNumRotationKeys, rotationData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT);
if (rotAccessor) animRef->Parameters.rotation = rotAccessor;
if ( rotAccessor ) {
animRef->Parameters.rotation = rotAccessor;
}
delete[] rotationData;
}
}

View File

@ -109,7 +109,7 @@ extern "C" {
/** Maximum dimension for strings, ASSIMP strings are zero terminated. */
#ifdef __cplusplus
const size_t MAXLEN = 1024;
static const size_t MAXLEN = 1024;
#else
# define MAXLEN 1024
#endif