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 )
|
if ( bufsize > 0 )
|
||||||
{
|
{
|
||||||
// Definitely in scenes.image
|
// Definitely in scenes.image
|
||||||
pBuffer = new char[ bufsize ];
|
pBuffer = malloc( bufsize );
|
||||||
if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, bufsize ) )
|
if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, bufsize ) )
|
||||||
{
|
{
|
||||||
delete[] pBuffer;
|
free( pBuffer );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -866,10 +866,10 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
|
|||||||
if ( bufsize <= 0 )
|
if ( bufsize <= 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pBuffer = new char[ bufsize ];
|
pBuffer = malloc( bufsize );
|
||||||
if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, bufsize ) )
|
if ( !scenefilecache->GetSceneData( filename, (byte *)pBuffer, bufsize ) )
|
||||||
{
|
{
|
||||||
delete[] pBuffer;
|
free( pBuffer );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,7 +897,7 @@ CChoreoScene *C_SceneEntity::LoadScene( const char *filename )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete[] pBuffer;
|
free( pBuffer );
|
||||||
return pScene;
|
return pScene;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,4 +1261,4 @@ void C_SceneEntity::PrefetchAnimBlocks( CChoreoScene *pScene )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Msg( "%d of %d animations resident\n", nResident, nChecked );
|
Msg( "%d of %d animations resident\n", nResident, nChecked );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user