Title: [152575] trunk/Source/WebKit2
Revision
152575
Author
[email protected]
Date
2013-07-11 12:40:07 -0700 (Thu, 11 Jul 2013)

Log Message

Use GOwnPtr in PluginProcessProxyUnix to manage stdOut variable
https://bugs.webkit.org/show_bug.cgi?id=118568

Patch by Sergio Correia <[email protected]> on 2013-07-11
Reviewed by Martin Robinson.

* UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
(WebKit::PluginProcessProxy::scanPlugin):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (152574 => 152575)


--- trunk/Source/WebKit2/ChangeLog	2013-07-11 18:57:57 UTC (rev 152574)
+++ trunk/Source/WebKit2/ChangeLog	2013-07-11 19:40:07 UTC (rev 152575)
@@ -1,3 +1,13 @@
+2013-07-11  Sergio Correia  <[email protected]>
+
+        Use GOwnPtr in PluginProcessProxyUnix to manage stdOut variable
+        https://bugs.webkit.org/show_bug.cgi?id=118568
+
+        Reviewed by Martin Robinson.
+
+        * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
+        (WebKit::PluginProcessProxy::scanPlugin):
+
 2013-07-11  Timothy Hatcher  <[email protected]>
 
         Revert r152267 and soft link WebInspectorUI.framework again.

Modified: trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp (152574 => 152575)


--- trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp	2013-07-11 18:57:57 UTC (rev 152574)
+++ trunk/Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp	2013-07-11 19:40:07 UTC (rev 152575)
@@ -37,6 +37,7 @@
 #include <wtf/text/WTFString.h>
 #if PLATFORM(GTK) || PLATFORM(EFL)
 #include <glib.h>
+#include <wtf/gobject/GOwnPtr.h>
 #endif
 
 using namespace WebCore;
@@ -70,7 +71,7 @@
     argv[3] = 0;
 
     int status;
-    char* stdOut = 0;
+    GOwnPtr<char> stdOut;
 
     // If the disposition of SIGCLD signal is set to SIG_IGN (default)
     // then the signal will be ignored and g_spawn_sync() will not be
@@ -84,16 +85,13 @@
         sigaction(SIGCLD, &action, 0);
     }
 
-    if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut, 0, &status, 0))
+    if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut.outPtr(), 0, &status, 0))
         return false;
 
-    if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS || !stdOut) {
-        free(stdOut);
+    if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS || !stdOut)
         return false;
-    }
 
-    String stdOutString(reinterpret_cast<const UChar*>(stdOut));
-    free(stdOut);
+    String stdOutString(reinterpret_cast<const UChar*>(stdOut.get()));
 
     Vector<String> lines;
     stdOutString.split(UChar('\n'), true, lines);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to