Bug 1642940 - Report OOM on table allocation failure. r=lth

Table::create() returns false when allocation fails, but does
not report the OOM. This commit adds appropriate calls to
ReportOutOfMemory around calls to Table::create().

Differential Revision: https://phabricator.services.mozilla.com/D80754
This commit is contained in:
Ryan Hunt 2020-06-24 06:54:02 +00:00
parent 813131c727
commit 0c490d558c
2 changed files with 2 additions and 0 deletions

View File

@ -2437,6 +2437,7 @@ WasmTableObject* WasmTableObject::create(JSContext* cx, uint32_t initialLength,
SharedTable table = Table::create(cx, td, obj);
if (!table) {
ReportOutOfMemory(cx);
return nullptr;
}

View File

@ -843,6 +843,7 @@ bool Module::instantiateLocalTable(JSContext* cx, const TableDesc& td,
} else {
table = Table::create(cx, td, /* HandleWasmTableObject = */ nullptr);
if (!table) {
ReportOutOfMemory(cx);
return false;
}
}