Reviewed by Sam Weinig.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jul 2008 05:52:37 +0000 (05:52 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jul 2008 05:52:37 +0000 (05:52 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=20169
        Memory allocated with fastMalloc is freed with delete

        * VM/JSPropertyNameIterator.cpp:
        (KJS::JSPropertyNameIterator::invalidate): Free the array properly.
        (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
        invalidate().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35439 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/VM/JSPropertyNameIterator.cpp

index 6c20273..5841b7b 100644 (file)
@@ -1,3 +1,15 @@
+2008-07-29  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=20169
+        Memory allocated with fastMalloc is freed with delete
+
+        * VM/JSPropertyNameIterator.cpp:
+        (KJS::JSPropertyNameIterator::invalidate): Free the array properly.
+        (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling
+        invalidate().
+
 2008-07-29  Mark Rowe  <mrowe@apple.com>
 
         Attempt to fix the Qt build.
index be5b180..0c14ea0 100644 (file)
@@ -60,7 +60,7 @@ JSPropertyNameIterator::JSPropertyNameIterator(JSObject* object, Identifier* pro
 
 JSPropertyNameIterator::~JSPropertyNameIterator()
 {
-    delete m_propertyNames;
+    invalidate();
 }
 
 JSType JSPropertyNameIterator::type() const
@@ -124,7 +124,11 @@ JSValue* JSPropertyNameIterator::next(ExecState* exec)
 
 void JSPropertyNameIterator::invalidate()
 {
-    delete m_propertyNames;
+    if (m_propertyNames) {
+        for (Identifier* p = m_propertyNames; p != m_end; ++p)
+            p->~Identifier();
+        fastFree(m_propertyNames);
+    }
     m_object = 0;
     m_propertyNames = 0;
 }