Bug 1391500 - Fix the new-delete-type-mismatch error that ASan reports. r?ehsan
MozReview-Commit-ID: 1iGtltDGj3T
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1052,16 +1052,18 @@ public:
// actual array in one allocation. The amount of memory to
// allocate is equal to the class's size + the number of bytes for all
// but the first array item (because aBaseSize includes one
// item, see the private declarations)
return ::operator new(aBaseSize +
(aArrayLen - 1) * sizeof(nsCSSShadowItem));
}
+ void operator delete(void* aPtr) { ::operator delete(aPtr); }
+
explicit nsCSSShadowArray(uint32_t aArrayLen) :
mLength(aArrayLen)
{
for (uint32_t i = 1; i < mLength; ++i) {
// Make sure we call the constructors of each nsCSSShadowItem
// (the first one is called for us because we declared it under private)
new (&mArray[i]) nsCSSShadowItem();
}