fix(lua): fix pointer.allocate allocating the wrong number of bytes (#2941)

This commit is contained in:
Quentin 2024-04-13 17:41:04 +02:00 committed by GitHub
parent 0dc5ad6137
commit 10bec398bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,7 +107,7 @@ namespace lua::memory
// Returns: pointer: A pointer to the newly allocated memory. // Returns: pointer: A pointer to the newly allocated memory.
static pointer allocate(int size, sol::this_state state) static pointer allocate(int size, sol::this_state state)
{ {
void* mem = new uint8_t[](size); void* mem = new uint8_t[size]();
big::lua_module* module = sol::state_view(state)["!this"]; big::lua_module* module = sol::state_view(state)["!this"];
module->m_allocated_memory.push_back(mem); module->m_allocated_memory.push_back(mem);