Fix potential leak memory for CRenderFxManager, CPointBaseCommand

CUtlVector::RemoveAll() doesn't free allocated memory
This commit is contained in:
s1lent 2019-08-13 22:52:00 +07:00
parent 0bd5f7a0bb
commit 7420ba158a
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
3 changed files with 14 additions and 4 deletions

View File

@ -150,5 +150,5 @@ void CPointBaseCommand::OnDestroy()
}
}
m_vecCommands.RemoveAll();
m_vecCommands.Purge();
}

View File

@ -373,7 +373,7 @@ void CRenderFxManager::Spawn()
void CRenderFxManager::OnDestroy()
{
m_RenderGroups.RemoveAll();
m_RenderGroups.Purge();
}
void CRenderFxManager::Restart()

View File

@ -148,6 +148,7 @@ public:
void RemoveAt(I i);
bool Remove(T const &remove);
void RemoveAll();
void Purge();
// Allocation, deletion
void FreeNode(I i);
@ -848,6 +849,15 @@ void CUtlRBTree<T, I, L, M>::RemoveAll()
m_NumElements = 0;
}
template <class T, class I, typename L, class M>
void CUtlRBTree<T, I, L, M>::Purge()
{
RemoveAll();
m_FirstFree = InvalidIndex();
m_TotalElements = 0;
m_Elements.Purge();
}
// Iteration
template <class T, class I, typename L, class M>
I CUtlRBTree<T, I, L, M>::FirstInorder() const