mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
LibWasm: Make MemoryInstance allocation fail if initial growth fails
...instead of silently ignoring the failure in the constructor.
This commit is contained in:
parent
117ca843bd
commit
4f2d898a51
2 changed files with 17 additions and 4 deletions
|
@ -43,7 +43,11 @@ Optional<TableAddress> Store::allocate(TableType const& type)
|
|||
Optional<MemoryAddress> Store::allocate(MemoryType const& type)
|
||||
{
|
||||
MemoryAddress address { m_memories.size() };
|
||||
m_memories.empend(MemoryInstance { type });
|
||||
auto instance = MemoryInstance::create(type);
|
||||
if (instance.is_error())
|
||||
return {};
|
||||
|
||||
m_memories.append(instance.release_value());
|
||||
return address;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue