Title: [97469] trunk/Tools
Revision
97469
Author
[email protected]
Date
2011-10-14 08:36:39 -0700 (Fri, 14 Oct 2011)

Log Message

[EFL] DRT: Do not use OwnFastMallocPtr to manage char*'s.
https://bugs.webkit.org/show_bug.cgi?id=70106

Patch by Raphael Kubo da Costa <[email protected]> on 2011-10-14
Reviewed by Antonio Gomes.

OwnFastMallocPtr was being used as a smart pointer that automatically called
free() on the strings returned by the EFL or by ewk.

However, when WTF is built in release mode, it uses its own memory management
code instead of using the system malloc(), free() and friends. This means bad
things will happen when one uses WTF's free() on memory allocated with system
malloc() by the EFL or ewk.

The easiest way to solve this is to call free() ourselves.

* DumpRenderTree/efl/DumpRenderTree.cpp:
(dumpFramesAsText):
(getFinalTestURL):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (97468 => 97469)


--- trunk/Tools/ChangeLog	2011-10-14 15:32:57 UTC (rev 97468)
+++ trunk/Tools/ChangeLog	2011-10-14 15:36:39 UTC (rev 97469)
@@ -1,5 +1,26 @@
 2011-10-14  Raphael Kubo da Costa  <[email protected]>
 
+        [EFL] DRT: Do not use OwnFastMallocPtr to manage char*'s.
+        https://bugs.webkit.org/show_bug.cgi?id=70106
+
+        Reviewed by Antonio Gomes.
+
+        OwnFastMallocPtr was being used as a smart pointer that automatically called
+        free() on the strings returned by the EFL or by ewk.
+
+        However, when WTF is built in release mode, it uses its own memory management
+        code instead of using the system malloc(), free() and friends. This means bad
+        things will happen when one uses WTF's free() on memory allocated with system
+        malloc() by the EFL or ewk.
+
+        The easiest way to solve this is to call free() ourselves.
+
+        * DumpRenderTree/efl/DumpRenderTree.cpp:
+        (dumpFramesAsText):
+        (getFinalTestURL):
+
+2011-10-14  Raphael Kubo da Costa  <[email protected]>
+
         [EFL] Add DumpRenderTreeSupportEfl
         https://bugs.webkit.org/show_bug.cgi?id=68458
 

Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp (97468 => 97469)


--- trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp	2011-10-14 15:32:57 UTC (rev 97468)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp	2011-10-14 15:36:39 UTC (rev 97469)
@@ -48,7 +48,6 @@
 #include <stdlib.h>
 #include <text/CString.h>
 #include <unistd.h>
-#include <wtf/OwnFastMallocPtr.h>
 #include <wtf/OwnPtr.h>
 
 OwnPtr<DumpRenderTreeChrome> browser;
@@ -76,9 +75,10 @@
         result.append("'\n--------\n");
     }
 
-    const OwnFastMallocPtr<char> frameContents(ewk_frame_plain_text_get(frame));
-    result.append(String::fromUTF8(frameContents.get()));
+    char* frameContents = ewk_frame_plain_text_get(frame);
+    result.append(String::fromUTF8(frameContents));
     result.append("\n");
+    free(frameContents);
 
     if (gLayoutTestController->dumpChildFramesAsText()) {
         Eina_List* children = DumpRenderTreeSupportEfl::frameChildren(frame);
@@ -178,11 +178,13 @@
 
     // Convert the path into a full file URL if it does not look
     // like an HTTP/S URL (doesn't start with http:// or https://).
-    if (!testURL.startsWith("http://") || !testURL.startsWith("https://")) {
-        OwnFastMallocPtr<char> filePath(ecore_file_realpath(testURL.utf8().data()));
+    if (!testURL.startsWith("http://") && !testURL.startsWith("https://")) {
+        char* cFilePath = ecore_file_realpath(testURL.utf8().data());
+        const String filePath = String::fromUTF8(cFilePath);
+        free(cFilePath);
 
-        if (ecore_file_exists(filePath.get()))
-            return String("file://") + String::fromUTF8(filePath.get());
+        if (ecore_file_exists(filePath.utf8().data()))
+            return String("file://") + filePath;
     }
 
     return testURL;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to