summaryrefslogtreecommitdiff
path: root/indra/llcharacter/llkeyframemotionparam.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcharacter/llkeyframemotionparam.cpp')
-rw-r--r--indra/llcharacter/llkeyframemotionparam.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp
index a9c1f6fc45..622405a5e1 100644
--- a/indra/llcharacter/llkeyframemotionparam.cpp
+++ b/indra/llcharacter/llkeyframemotionparam.cpp
@@ -364,18 +364,13 @@ BOOL LLKeyframeMotionParam::loadMotions()
}
// allocate a text buffer
- char *text = new char[ fileSize+1 ];
- if ( !text )
- {
- llinfos << "ERROR: can't allocated keyframe text buffer." << llendl;
- return FALSE;
- }
+ std::vector<char> text(fileSize+1);
//-------------------------------------------------------------------------
// load data from file into buffer
//-------------------------------------------------------------------------
bool error = false;
- char *p = text;
+ char *p = &text[0];
while ( 1 )
{
if (apr_file_eof(fp) == APR_EOF)
@@ -399,12 +394,11 @@ BOOL LLKeyframeMotionParam::loadMotions()
//-------------------------------------------------------------------------
// check for error
//-------------------------------------------------------------------------
- llassert( p <= (text+fileSize) );
+ llassert( p <= (&text[0] + fileSize) );
if ( error )
{
llinfos << "ERROR: error while reading from " << path << llendl;
- delete [] text;
return FALSE;
}
@@ -413,7 +407,7 @@ BOOL LLKeyframeMotionParam::loadMotions()
//-------------------------------------------------------------------------
// parse the text and build keyframe data structures
//-------------------------------------------------------------------------
- p = text;
+ p = &text[0];
S32 num;
char strA[80]; /* Flawfinder: ignore */
char strB[80]; /* Flawfinder: ignore */
@@ -432,7 +426,6 @@ BOOL LLKeyframeMotionParam::loadMotions()
if ((num != 3))
{
llinfos << "WARNING: can't read parametric motion" << llendl;
- delete [] text;
return FALSE;
}
@@ -453,7 +446,6 @@ BOOL LLKeyframeMotionParam::loadMotions()
num = sscanf(p, "%79s %79s %f", strA, strB, &floatA); /* Flawfinder: ignore */
}
- delete [] text;
return TRUE;
}