Plug leak in CSSSelectorList::deleteSelectors().
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 May 2013 02:28:25 +0000 (02:28 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 May 2013 02:28:25 +0000 (02:28 +0000)
<http://webkit.org/b/116371>
<rdar://problem/13930698>

Reviewed by Ryosuke Niwa.

Don't forget to destroy the very last selector in the list.

* css/CSSSelectorList.cpp:
(WebCore::CSSSelectorList::deleteSelectors):

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSSelectorList.cpp

index 53a8d44..a0de0d9 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-17  Andreas Kling  <akling@apple.com>
+
+        Plug leak in CSSSelectorList::deleteSelectors().
+        <http://webkit.org/b/116371>
+        <rdar://problem/13930698>
+
+        Reviewed by Ryosuke Niwa.
+
+        Don't forget to destroy the very last selector in the list.
+
+        * css/CSSSelectorList.cpp:
+        (WebCore::CSSSelectorList::deleteSelectors):
+
 2013-05-17  Anders Carlsson  <andersca@apple.com>
 
         Share code between WebKit1 and WebKit2 StorageArea subclasses
index cd5b4d4..f76b4a8 100644 (file)
@@ -100,8 +100,11 @@ void CSSSelectorList::deleteSelectors()
     if (!m_selectorArray)
         return;
 
-    for (CSSSelector* s = m_selectorArray; !s->isLastInSelectorList(); ++s)
+    for (CSSSelector* s = m_selectorArray; ; ++s) {
         s->~CSSSelector();
+        if (s->isLastInSelectorList())
+            break;
+    }
     fastFree(m_selectorArray);
 }