Script: Fix leaking tables passed from Lua

This commit is contained in:
Vicki Pfau 2023-01-31 17:07:03 -08:00
parent 92d86af955
commit 5a5adc1b15
1 changed files with 2 additions and 0 deletions

View File

@ -591,6 +591,7 @@ struct mScriptValue* _luaCoerceTable(struct mScriptEngineContextLua* luaContext)
size_t len = mScriptTableSize(table);
if (!isList || !len) {
mScriptContextFillPool(luaContext->d.context, table);
return table;
}
@ -600,6 +601,7 @@ struct mScriptValue* _luaCoerceTable(struct mScriptEngineContextLua* luaContext)
struct mScriptValue* value = mScriptTableLookup(table, &mSCRIPT_MAKE_S64(i));
if (!value) {
mScriptValueDeref(list);
mScriptContextFillPool(luaContext->d.context, table);
return table;
}
mScriptValueWrap(value, mScriptListAppend(list->value.list));