Title: [207842] trunk/Source/_javascript_Core
Revision
207842
Author
[email protected]
Date
2016-10-25 13:33:46 -0700 (Tue, 25 Oct 2016)

Log Message

jsc.cpp is leaking memory allocated by readline in runInteractive
https://bugs.webkit.org/show_bug.cgi?id=163958

According to http://web.mit.edu/gnu/doc/html/rlman_2.html,
"The line readline returns is allocated with malloc ();
you should free () the line when you are done with it."
The memory allocated by readline is not being freed when it should.

Patch by Christopher Reid <[email protected]> on 2016-10-25
Reviewed by Mark Lam.

* jsc.cpp:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (207841 => 207842)


--- trunk/Source/_javascript_Core/ChangeLog	2016-10-25 20:23:10 UTC (rev 207841)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-10-25 20:33:46 UTC (rev 207842)
@@ -1,3 +1,17 @@
+2016-10-25  Christopher Reid  <[email protected]>
+
+        jsc.cpp is leaking memory allocated by readline in runInteractive
+        https://bugs.webkit.org/show_bug.cgi?id=163958
+
+        According to http://web.mit.edu/gnu/doc/html/rlman_2.html,
+        "The line readline returns is allocated with malloc ();
+        you should free () the line when you are done with it."
+        The memory allocated by readline is not being freed when it should.
+
+        Reviewed by Mark Lam.
+
+        * jsc.cpp:
+
 2016-10-25  Konstantin Tokarev  <[email protected]>
 
         [cmake] Check if jscLib and WebKitGUID targets exist before using them

Modified: trunk/Source/_javascript_Core/jsc.cpp (207841 => 207842)


--- trunk/Source/_javascript_Core/jsc.cpp	2016-10-25 20:23:10 UTC (rev 207841)
+++ trunk/Source/_javascript_Core/jsc.cpp	2016-10-25 20:33:46 UTC (rev 207842)
@@ -2629,9 +2629,12 @@
             source = source + line;
             source = source + '\n';
             checkSyntax(globalObject->vm(), makeSource(source, interpreterName), error);
-            if (!line[0])
+            if (!line[0]) {
+                free(line);
                 break;
+            }
             add_history(line);
+            free(line);
         } while (error.syntaxErrorType() == ParserError::SyntaxErrorRecoverable);
         
         if (error.isValid()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to