diff options
author | trav90 <travawine@palemoon.org> | 2018-09-02 18:59:51 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-09-02 20:07:47 -0500 |
commit | 36cb80d1cac66a1511bec4ad97947a2deeab2e08 (patch) | |
tree | 71212ddd26aa7a37b5ef4c5390e3e33c4db69c94 /js/src/vm/Scope.cpp | |
parent | b4aed63f5758b955e84840c5871b1301ccb6968f (diff) | |
download | UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.tar UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.tar.gz UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.tar.lz UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.tar.xz UXP-36cb80d1cac66a1511bec4ad97947a2deeab2e08.zip |
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.
Diffstat (limited to 'js/src/vm/Scope.cpp')
-rw-r--r-- | js/src/vm/Scope.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/js/src/vm/Scope.cpp b/js/src/vm/Scope.cpp index 25e389d8a..8bb1702ea 100644 --- a/js/src/vm/Scope.cpp +++ b/js/src/vm/Scope.cpp @@ -191,12 +191,12 @@ template <typename ConcreteScope> static UniquePtr<typename ConcreteScope::Data> NewEmptyScopeData(ExclusiveContext* cx, uint32_t length = 0) { - uint8_t* bytes = cx->zone()->pod_calloc<uint8_t>(ConcreteScope::sizeOfData(length)); + uint8_t* bytes = cx->zone()->pod_malloc<uint8_t>(ConcreteScope::sizeOfData(length)); if (!bytes) ReportOutOfMemory(cx); auto data = reinterpret_cast<typename ConcreteScope::Data*>(bytes); if (data) - new (data) typename ConcreteScope::Data(); + new (data) typename ConcreteScope::Data(length); return UniquePtr<typename ConcreteScope::Data>(data); } |