mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-12 06:47:56 +03:00
Switch to malloc() for C_SceneEntity::LoadScene()
It used new char[] before, but it seems when the buffer is allocated using filesystem->ReadFileEx() we should free() the buffer, not delete[] it. CUtlBuffer also free()s the buffer, so malloc() should be the saner choice here.
This commit is contained in:
parent
77fada1ca2
commit
4d45c32be9
@ -823,10 +823,10 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
|
||||
if ( bufsize > 0 )
|
||||
{
|
||||
// Definitely in scenes.image
|
||||
pBuffer = new char[ bufsize ];
|
||||
pBuffer = malloc( bufsize );
|
||||
if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, bufsize ) )
|
||||
{
|
||||
delete[] pBuffer;
|
||||
free( pBuffer );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -866,10 +866,10 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
|
||||
if ( bufsize <= 0 )
|
||||
return NULL;
|
||||
|
||||
pBuffer = new char[ bufsize ];
|
||||
pBuffer = malloc( bufsize );
|
||||
if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, bufsize ) )
|
||||
{
|
||||
delete[] pBuffer;
|
||||
free( pBuffer );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -897,7 +897,7 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
|
||||
}
|
||||
#endif
|
||||
|
||||
delete[] pBuffer;
|
||||
free( pBuffer );
|
||||
return pScene;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user