Title: [233420] trunk/Source/WTF
Revision
233420
Author
[email protected]
Date
2018-07-02 04:41:30 -0700 (Mon, 02 Jul 2018)

Log Message

[Linux] Fix memory leak in WTF::forEachLine()
https://bugs.webkit.org/show_bug.cgi?id=187174

Reviewed by Žan Doberšek.

* wtf/linux/MemoryFootprintLinux.cpp:
(WTF::forEachLine):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (233419 => 233420)


--- trunk/Source/WTF/ChangeLog	2018-07-02 11:30:52 UTC (rev 233419)
+++ trunk/Source/WTF/ChangeLog	2018-07-02 11:41:30 UTC (rev 233420)
@@ -1,3 +1,13 @@
+2018-07-02  Alicia Boya García  <[email protected]>
+
+        [Linux] Fix memory leak in WTF::forEachLine()
+        https://bugs.webkit.org/show_bug.cgi?id=187174
+
+        Reviewed by Žan Doberšek.
+
+        * wtf/linux/MemoryFootprintLinux.cpp:
+        (WTF::forEachLine):
+
 2018-07-02  Frederic Wang  <[email protected]>
 
         WTF's internal std::optional implementation should abort() on bad optional access

Modified: trunk/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp (233419 => 233420)


--- trunk/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp	2018-07-02 11:30:52 UTC (rev 233419)
+++ trunk/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp	2018-07-02 11:41:30 UTC (rev 233420)
@@ -41,11 +41,9 @@
     char* buffer = nullptr;
     size_t size = 0;
     while (getline(&buffer, &size, file) != -1) {
-        functor(buffer, size);
-        free(buffer);
-        buffer = nullptr;
-        size = 0;
+        functor(buffer);
     }
+    free(buffer);
 }
 #endif
 
@@ -58,7 +56,7 @@
 
     unsigned long totalPrivateDirtyInKB = 0;
     bool isAnonymous = false;
-    forEachLine(file, [&] (char* buffer, size_t) {
+    forEachLine(file, [&] (char* buffer) {
         {
             unsigned long start;
             unsigned long end;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to