mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-03-04 09:45:26 +03:00
Fix dubious ScriptVariant_t Free()'s
When assigning a null value in getVariant(), make sure a previous SV_FREE is not carried over. In SqurrelVM::ReleaseValue(), make sure SV_FREE is not kept after Free()ing a value.
This commit is contained in:
parent
80f19601ee
commit
879b9e8d25
@ -1205,6 +1205,7 @@ bool getVariant(HSQUIRRELVM vm, SQInteger idx, ScriptVariant_t& variant)
|
||||
{
|
||||
case OT_NULL:
|
||||
{
|
||||
variant.m_flags = 0;
|
||||
// TODO: Should this be (HSCRIPT)nullptr
|
||||
variant.m_type = FIELD_VOID;
|
||||
return true;
|
||||
@ -3074,6 +3075,7 @@ void SquirrelVM::ReleaseValue(ScriptVariant_t& value)
|
||||
|
||||
// Let's prevent this being called again and giving some UB
|
||||
value.m_type = FIELD_VOID;
|
||||
value.m_flags = 0;
|
||||
}
|
||||
|
||||
bool SquirrelVM::ClearValue(HSCRIPT hScope, const char* pszKey)
|
||||
|
Loading…
x
Reference in New Issue
Block a user