mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 06:18:38 +09:00
Call the relevant scope-data constructor when allocating it, and poison/mark as undefined the memory for the trailing array of BindingNames, ratther than impermissibly PodZero-ing non-trivial classes.
This commit is contained in:
parent
4cbf54089a
commit
78d0ec7fc9
4 changed files with 72 additions and 31 deletions
|
|
@ -1453,13 +1453,11 @@ template <typename Scope>
|
|||
static typename Scope::Data*
|
||||
NewEmptyBindingData(ExclusiveContext* cx, LifoAlloc& alloc, uint32_t numBindings)
|
||||
{
|
||||
using Data = typename Scope::Data;
|
||||
size_t allocSize = Scope::sizeOfData(numBindings);
|
||||
auto* bindings = static_cast<typename Scope::Data*>(alloc.alloc(allocSize));
|
||||
if (!bindings) {
|
||||
auto* bindings = alloc.allocInSize<Data>(allocSize, numBindings);
|
||||
if (!bindings)
|
||||
ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
}
|
||||
PodZero(bindings);
|
||||
return bindings;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue