Various misc. tweaks and fixes based on static code analysis to minimize/fix memleaks, crashes, or other performance impacting code.

This commit is contained in:
Areloch 2020-09-19 18:25:10 -05:00
parent d76c73c252
commit 8956559bfd
44 changed files with 124 additions and 258 deletions

View file

@ -770,6 +770,8 @@ static void conditioner_createDefaultClip(domCOLLADA* root)
static void conditioner_fixupAnimation(domAnimation* anim)
{
S32 visibilityLen = dStrlen("/visibility");
for (S32 iChannel = 0; iChannel < anim->getChannel_array().getCount(); iChannel++) {
// Get the animation elements: <channel>, <sampler>
@ -815,7 +817,7 @@ static void conditioner_fixupAnimation(domAnimation* anim)
// Get parent SID string
char *parentSID = dStrdup(channel->getTarget());
parentSID[dStrlen(parentSID) - dStrlen("/visibility")] = '\0';
parentSID[dStrlen(parentSID) - visibilityLen] = '\0';
// Find the parent element (should be a <node>)
daeSIDResolver parentResolver(channel, parentSID);
@ -3039,4 +3041,4 @@ void ColladaUtils::ExportData::processData()
}
}
}
}
}

View file

@ -64,6 +64,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector
if (objectList.size() == 0)
dumpLine("\r\n");
S32 nodeNameLen = dStrlen(nodeName);
S32 spaceCount = -1;
for (S32 j=0;j<objectList.size(); j++)
{
@ -101,7 +102,7 @@ void TSShapeInstance::dumpNode(Stream & stream ,S32 level, S32 nodeIndex, Vector
// how many spaces should we prepend if we have another object on this node
if (spaceCount<0)
spaceCount = (S32)(dStrlen(space) + dStrlen(nodeName));
spaceCount = (S32)(dStrlen(space) + nodeNameLen);
if(spaceCount > 2000)
spaceCount = 2000;

View file

@ -424,6 +424,8 @@ bool TSShapeConstructor::onAdd()
group = new SimGroup();
if ( !group->registerObject("TSShapeConstructorGroup") )
{
SAFE_DELETE(group);
Con::errorf("TSShapeConstructor::onAdd failed: Could not register "
"TSShapeConstructorGroup");
return false;