Skip to content

Commit

Permalink
Fix a LUA stack leak with a missing init fn in wtse (#7889)
Browse files Browse the repository at this point in the history
Oops! If I get a nil I still need to pop it.
  • Loading branch information
baconpaul authored Dec 1, 2024
1 parent 03373f9 commit f6274e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/LuaSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ Surge::LuaSupport::SGLD::~SGLD()
{
std::cout << "Guarded stack leak: [" << label << "] exit=" << nt << " enter=" << top
<< std::endl;
for (int i = nt; i >= top; i--)
{
std::cout << " " << i << " -> " << lua_typename(L, lua_type(L, i)) << std::endl;
}
}
#endif
}
Expand Down
1 change: 1 addition & 0 deletions src/common/dsp/WavetableScriptEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct LuaWTEvaluator::Details
lua_getglobal(L, "init");
if (!lua_isfunction(L, -1))
{
lua_pop(L, -1);
makeEmptyState(true);
}
else
Expand Down

0 comments on commit f6274e6

Please sign in to comment.