mirror of https://github.com/mgba-emu/mgba.git
Script: Fix leaking tables passed from Lua
This commit is contained in:
parent
92d86af955
commit
5a5adc1b15
|
@ -591,6 +591,7 @@ struct mScriptValue* _luaCoerceTable(struct mScriptEngineContextLua* luaContext)
|
||||||
|
|
||||||
size_t len = mScriptTableSize(table);
|
size_t len = mScriptTableSize(table);
|
||||||
if (!isList || !len) {
|
if (!isList || !len) {
|
||||||
|
mScriptContextFillPool(luaContext->d.context, table);
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,6 +601,7 @@ struct mScriptValue* _luaCoerceTable(struct mScriptEngineContextLua* luaContext)
|
||||||
struct mScriptValue* value = mScriptTableLookup(table, &mSCRIPT_MAKE_S64(i));
|
struct mScriptValue* value = mScriptTableLookup(table, &mSCRIPT_MAKE_S64(i));
|
||||||
if (!value) {
|
if (!value) {
|
||||||
mScriptValueDeref(list);
|
mScriptValueDeref(list);
|
||||||
|
mScriptContextFillPool(luaContext->d.context, table);
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
mScriptValueWrap(value, mScriptListAppend(list->value.list));
|
mScriptValueWrap(value, mScriptListAppend(list->value.list));
|
||||||
|
|
Loading…
Reference in New Issue