Bug 1391500 - Fix the new-delete-type-mismatch error that ASan reports. r?ehsan draft
authorTing-Yu Chou <janus926@gmail.com>
Fri, 18 Aug 2017 11:39:14 +0800
changeset 648636 7c36d132133a107540cbb5c36d3bafe0db2aa991
parent 647355 9ab2470a3210324bc11320531b15d195aaf05051
child 726890 43450d2ae4d7194875afe2b9b362584b23ca9e45
push id74829
push userbmo:janus926@gmail.com
push dateFri, 18 Aug 2017 03:41:08 +0000
reviewersehsan
bugs1391500
milestone57.0a1
Bug 1391500 - Fix the new-delete-type-mismatch error that ASan reports. r?ehsan MozReview-Commit-ID: 1iGtltDGj3T
layout/style/nsStyleStruct.h
--- 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();
     }