Fix coverity findings: fix usage after free.
parent
9d4d2b2a1c
commit
cc860ede66
|
@ -74,20 +74,22 @@ static const aiImporterDesc desc = {
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
SMDImporter::SMDImporter()
|
SMDImporter::SMDImporter()
|
||||||
: configFrameID(),
|
: configFrameID(),
|
||||||
mBuffer(),
|
mBuffer(),
|
||||||
pScene(),
|
pScene( nullptr ),
|
||||||
iFileSize(),
|
iFileSize( 0 ),
|
||||||
iSmallestFrame(),
|
iSmallestFrame( -1 ),
|
||||||
dLengthOfAnim(),
|
dLengthOfAnim( 0.0 ),
|
||||||
bHasUVs(),
|
bHasUVs(false ),
|
||||||
iLineNumber()
|
iLineNumber(-1) {
|
||||||
{}
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Destructor, private as well
|
// Destructor, private as well
|
||||||
SMDImporter::~SMDImporter()
|
SMDImporter::~SMDImporter() {
|
||||||
{}
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the class can handle the format of the given file.
|
// Returns whether the class can handle the format of the given file.
|
||||||
|
@ -133,9 +135,8 @@ void SMDImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS
|
||||||
// Allocate storage and copy the contents of the file to a memory buffer
|
// Allocate storage and copy the contents of the file to a memory buffer
|
||||||
this->pScene = pScene;
|
this->pScene = pScene;
|
||||||
|
|
||||||
std::vector<char> buff(iFileSize+1);
|
mBuffer.resize( iFileSize + 1 );
|
||||||
TextFileToBuffer(file.get(),buff);
|
TextFileToBuffer(file.get(), mBuffer );
|
||||||
mBuffer = &buff[0];
|
|
||||||
|
|
||||||
iSmallestFrame = (1 << 31);
|
iSmallestFrame = (1 << 31);
|
||||||
bHasUVs = true;
|
bHasUVs = true;
|
||||||
|
@ -694,7 +695,7 @@ void SMDImporter::CreateOutputMaterials()
|
||||||
// Parse the file
|
// Parse the file
|
||||||
void SMDImporter::ParseFile()
|
void SMDImporter::ParseFile()
|
||||||
{
|
{
|
||||||
const char* szCurrent = mBuffer;
|
const char* szCurrent = &mBuffer[0];
|
||||||
|
|
||||||
// read line per line ...
|
// read line per line ...
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
|
|
|
@ -372,7 +372,7 @@ private:
|
||||||
unsigned int configFrameID;
|
unsigned int configFrameID;
|
||||||
|
|
||||||
/** Buffer to hold the loaded file */
|
/** Buffer to hold the loaded file */
|
||||||
const char* mBuffer;
|
std::vector<char> mBuffer;
|
||||||
|
|
||||||
/** Output scene to be filled
|
/** Output scene to be filled
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue