mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 12:06:07 +08:00
Sync with latest source-sdk-2013.
This commit is contained in:
@ -249,15 +249,16 @@ void CUtlBlockMemory<T,I>::ChangeSize( int nBlocks )
|
||||
|
||||
UTLBLOCKMEMORY_TRACK_ALLOC(); // this must stay after the recalculation of m_nBlocks, since it implicitly uses the new value
|
||||
|
||||
// free old blocks if shrinking
|
||||
for ( int i = m_nBlocks; i < nBlocksOld; ++i )
|
||||
{
|
||||
UTLBLOCKMEMORY_TRACK_FREE();
|
||||
free( (void*)m_pMemory[ i ] );
|
||||
}
|
||||
|
||||
if ( m_pMemory )
|
||||
{
|
||||
// free old blocks if shrinking
|
||||
// Only possible if m_pMemory is non-NULL (and avoids PVS-Studio warning)
|
||||
for ( int i = m_nBlocks; i < nBlocksOld; ++i )
|
||||
{
|
||||
UTLBLOCKMEMORY_TRACK_FREE();
|
||||
free( (void*)m_pMemory[ i ] );
|
||||
}
|
||||
|
||||
MEM_ALLOC_CREDIT_CLASS();
|
||||
m_pMemory = (T**)realloc( m_pMemory, m_nBlocks * sizeof(T*) );
|
||||
Assert( m_pMemory );
|
||||
|
Reference in New Issue
Block a user