Skip to content

Commit

Permalink
Fixed the stack leak
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelIT7 committed Apr 5, 2024
1 parent 8558fde commit 0714fab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/lua_ILuaInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,21 +562,23 @@ void RunHook(GarrysMod::Lua::ILuaInterface* LUA, const char* name, ILuaValue* ar
PushValue(LUA, args);
}

LUA->Pop(pushed + 1);
/*LUA->CallFunctionProtected(pushed, 0, true);
LUA->CallFunctionProtected(pushed, 0, true);

if (args->type != GarrysMod::Lua::Type::Table && pushed != args->number) // We use pushed as a safeguard if something somehow breaks stuff.
{
std::string err_msg = "hook.Run had an Internal error. Report this please";
err_msg = err_msg + "(" + name + ")";
//LUA->ThrowError(err_msg.c_str());
}*/
LUA->ThrowError(err_msg.c_str());
}
SafeDelete(args);
} else {
LUA->Pop(1);
SafeDelete(args);
LUA->ThrowError("hook.Run is missing or not a function!");
}
LUA->Pop(2);
} else {
LUA->Pop(2);
SafeDelete(args);
LUA->ThrowError("hook table is missing or not a table!");
}
Expand Down

0 comments on commit 0714fab

Please sign in to comment.