From 519b7db38d46333ebc257cb8dad9d804c67a123e Mon Sep 17 00:00:00 2001 From: jeefo Date: Sat, 21 Nov 2020 22:19:50 +0300 Subject: [PATCH] Fixed memory leak with hintmessage. (#581) Fixed memory leak with hintmessage. --- regamedll/dlls/hintmessage.cpp | 11 ++--------- regamedll/dlls/player.cpp | 1 + regamedll/public/utlvector.h | 10 ++++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/regamedll/dlls/hintmessage.cpp b/regamedll/dlls/hintmessage.cpp index f6c1c6b66..71f47d912 100644 --- a/regamedll/dlls/hintmessage.cpp +++ b/regamedll/dlls/hintmessage.cpp @@ -15,10 +15,7 @@ CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector::PurgeAndDeleteElements() Purge(); } +template +inline void CUtlVector::PurgeAndDeleteArrays() +{ + for (int i = 0; i < m_Size; i++) + delete[] Element(i); + + Purge(); +} + template void CUtlVector::SetGrowSize(int size) {