From 3e9d3deda2eb3428cade7b1b1cbc55d0cf0d4304 Mon Sep 17 00:00:00 2001 From: Moofles <62188664+moofemp@users.noreply.github.com> Date: Tue, 27 Jul 2021 17:50:32 -0400 Subject: [PATCH] Use AllocPooledString() to prevent memory leak in logic_substring Co-authored-by: Spencer Brown --- sp/src/game/server/logic_substring.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sp/src/game/server/logic_substring.cpp b/sp/src/game/server/logic_substring.cpp index d1e9b96c..7c7d153b 100644 --- a/sp/src/game/server/logic_substring.cpp +++ b/sp/src/game/server/logic_substring.cpp @@ -80,7 +80,8 @@ void CLogicSubstring::InputInValue( inputdata_t &inputData ) } char* strOutValue = (char*)malloc( lengthCheck ); Q_strncpy( strOutValue, inputData.value.String() + startPosCheck, lengthCheck ); - m_OutValue.Set( MAKE_STRING(strOutValue), inputData.pActivator, this ); + m_OutValue.Set( AllocPooledString(strOutValue), inputData.pActivator, this ); + free(strOutValue); } //-----------------------------------------------------------------------------