Title: [99608] trunk/Source/_javascript_Core
Revision
99608
Author
msab...@apple.com
Date
2011-11-08 12:37:52 -0800 (Tue, 08 Nov 2011)

Log Message

JSC::Parser::Parser leaks Lexer member
https://bugs.webkit.org/show_bug.cgi?id=71847

Changed m_lexer member of Parser to be OwnPtr to fix a memory leak.

Reviewed by Oliver Hunt.

* parser/Parser.cpp:
(JSC::Parser::Parser):
(JSC::Parser::parseFunctionBody):
* parser/Parser.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (99607 => 99608)


--- trunk/Source/_javascript_Core/ChangeLog	2011-11-08 20:33:30 UTC (rev 99607)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-11-08 20:37:52 UTC (rev 99608)
@@ -1,3 +1,17 @@
+2011-11-08  Michael Saboff  <msab...@apple.com>
+
+        JSC::Parser::Parser leaks Lexer member
+        https://bugs.webkit.org/show_bug.cgi?id=71847
+
+        Changed m_lexer member of Parser to be OwnPtr to fix a memory leak.
+
+        Reviewed by Oliver Hunt.
+
+        * parser/Parser.cpp:
+        (JSC::Parser::Parser):
+        (JSC::Parser::parseFunctionBody):
+        * parser/Parser.h:
+
 2011-11-08  Yuqiang Xian  <yuqiang.x...@intel.com>
 
         Enable DFG JIT by default on X86 Linux and Mac platforms

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (99607 => 99608)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2011-11-08 20:33:30 UTC (rev 99607)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2011-11-08 20:37:52 UTC (rev 99608)
@@ -57,7 +57,7 @@
     , m_lastIdentifier(0)
     , m_sourceElements(0)
 {
-    m_lexer = new Lexer<UChar>(globalData);
+    m_lexer = adoptPtr(new Lexer<UChar>(globalData));
     m_arena = m_globalData->parserArena;
     m_lexer->setCode(source, m_arena);
 
@@ -740,7 +740,7 @@
         return context.createFunctionBody(m_lexer->lastLineNumber(), strictMode());
     DepthManager statementDepth(&m_statementDepth);
     m_statementDepth = 0;
-    typename TreeBuilder::FunctionBodyBuilder bodyBuilder(const_cast<JSGlobalData*>(m_globalData), m_lexer);
+    typename TreeBuilder::FunctionBodyBuilder bodyBuilder(const_cast<JSGlobalData*>(m_globalData), m_lexer.get());
     failIfFalse(parseSourceElements<CheckForStrictMode>(bodyBuilder));
     return context.createFunctionBody(m_lexer->lastLineNumber(), strictMode());
 }

Modified: trunk/Source/_javascript_Core/parser/Parser.h (99607 => 99608)


--- trunk/Source/_javascript_Core/parser/Parser.h	2011-11-08 20:33:30 UTC (rev 99607)
+++ trunk/Source/_javascript_Core/parser/Parser.h	2011-11-08 20:37:52 UTC (rev 99608)
@@ -920,7 +920,7 @@
     mutable const JSGlobalData* m_globalData;
     const SourceCode* m_source;
     ParserArena* m_arena;
-    Lexer<UChar>* m_lexer;
+    OwnPtr< Lexer<UChar> > m_lexer;
     
     StackBounds m_stack;
     bool m_error;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to