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:
Alexander 'z33ky' Hirsch 2024-11-12 23:53:30 +01:00
parent 80f19601ee
commit 879b9e8d25

View File

@ -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)