Use AllocPooledString() to prevent memory leak in logic_substring

Co-authored-by: Spencer Brown <spencerb21@live.com>
This commit is contained in:
Moofles 2021-07-27 17:50:32 -04:00 committed by GitHub
parent 99a8bdcb37
commit 3e9d3deda2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
//-----------------------------------------------------------------------------