[WK2][GTK][EFL] standard_output returned by g_spawn_sync must be freed
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Oct 2012 09:19:34 +0000 (09:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Oct 2012 09:19:34 +0000 (09:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98384

Patch by Sudarsana Nagineni <sudarsana.nagineni@intel.com> on 2012-10-05
Reviewed by Gyuyoung Kim.

Free the standard_output returned by g_spawn_sync() to avoid
a memory leak.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@130490 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp

index cbfa64a..18f5186 100644 (file)
@@ -1,3 +1,16 @@
+2012-10-05  Sudarsana Nagineni  <sudarsana.nagineni@intel.com>
+
+        [WK2][GTK][EFL] standard_output returned by g_spawn_sync must be freed
+        https://bugs.webkit.org/show_bug.cgi?id=98384
+
+        Reviewed by Gyuyoung Kim.
+
+        Free the standard_output returned by g_spawn_sync() to avoid
+        a memory leak.
+
+        * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
+        (WebKit::PluginProcessProxy::scanPlugin):
+
 2012-10-05  Jongseok Yang  <js45.yang@samsung.com>
 
         [EFL][WK2] Remove "web" word from ewk_resource APIs
index 1080cb8..3febb06 100644 (file)
@@ -64,8 +64,10 @@ bool PluginProcessProxy::scanPlugin(const String& pluginPath, RawPluginMetaData&
     if (!g_spawn_sync(0, argv, 0, G_SPAWN_STDERR_TO_DEV_NULL, 0, 0, &stdOut, 0, &status, 0))
         return false;
 
-    if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS)
+    if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) {
+        free(stdOut);
         return false;
+    }
 
     const unsigned kNumLinesExpected = 3;
     String lines[kNumLinesExpected];