mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Fix crash introduced in 605cdcb5
.
This commit is contained in:
parent
f6882e2a5d
commit
9b9a883d07
@ -9,8 +9,9 @@ SourceContents::SourceContents()
|
||||
: m_file( nullptr )
|
||||
, m_fileStringIdx( 0 )
|
||||
, m_data( nullptr )
|
||||
, m_dataBuf( nullptr )
|
||||
, m_dataSize( 0 )
|
||||
, m_dataBuf( nullptr )
|
||||
, m_dataBufSize( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
@ -44,14 +45,15 @@ void SourceContents::Parse( const char* fileName, const Worker& worker, const Vi
|
||||
fseek( f, 0, SEEK_END );
|
||||
sz = ftell( f );
|
||||
fseek( f, 0, SEEK_SET );
|
||||
if( sz > m_dataSize )
|
||||
if( sz > m_dataBufSize )
|
||||
{
|
||||
delete[] m_dataBuf;
|
||||
m_dataBuf = new char[sz];
|
||||
m_dataSize = sz;
|
||||
m_dataBufSize = sz;
|
||||
}
|
||||
fread( m_dataBuf, 1, sz, f );
|
||||
m_data = m_dataBuf;
|
||||
m_dataSize = sz;
|
||||
fclose( f );
|
||||
}
|
||||
else
|
||||
@ -73,7 +75,6 @@ void SourceContents::Parse( const char* source )
|
||||
m_file = nullptr;
|
||||
m_fileStringIdx = 0;
|
||||
m_data = source;
|
||||
m_dataBuf = nullptr;
|
||||
m_dataSize = len;
|
||||
Tokenize( source, len );
|
||||
}
|
||||
|
@ -38,9 +38,11 @@ private:
|
||||
uint32_t m_fileStringIdx;
|
||||
|
||||
const char* m_data;
|
||||
char* m_dataBuf;
|
||||
size_t m_dataSize;
|
||||
|
||||
char* m_dataBuf;
|
||||
size_t m_dataBufSize;
|
||||
|
||||
std::vector<Tokenizer::Line> m_lines;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user