Title: [149997] releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk
Revision
149997
Author
[email protected]
Date
2013-05-13 00:55:55 -0700 (Mon, 13 May 2013)

Log Message

Merge r149666 - [GTK] Initialize WebKitWebPlugin path to prevent double-free
https://bugs.webkit.org/show_bug.cgi?id=115624

Patch by Tomas Popela <[email protected]> on 2013-05-07
Reviewed by Carlos Garcia Campos.

Use GOwnPtr for WebKitWebPlugin path to prevent double-free
situations. Also use GOwnPtr for GError in webkit_web_plugin_get_path.

* webkit/webkitwebplugin.cpp:
(webkit_web_plugin_finalize):
(webkit_web_plugin_get_path):
* webkit/webkitwebpluginprivate.h:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/ChangeLog (149996 => 149997)


--- releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/ChangeLog	2013-05-13 07:43:02 UTC (rev 149996)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/ChangeLog	2013-05-13 07:55:55 UTC (rev 149997)
@@ -1,3 +1,18 @@
+2013-05-07  Tomas Popela  <[email protected]>
+
+        [GTK] Initialize WebKitWebPlugin path to prevent double-free
+        https://bugs.webkit.org/show_bug.cgi?id=115624
+
+        Reviewed by Carlos Garcia Campos.
+
+        Use GOwnPtr for WebKitWebPlugin path to prevent double-free
+        situations. Also use GOwnPtr for GError in webkit_web_plugin_get_path.
+
+        * webkit/webkitwebplugin.cpp:
+        (webkit_web_plugin_finalize):
+        (webkit_web_plugin_get_path):
+        * webkit/webkitwebpluginprivate.h:
+
 2013-05-02  Zan Dobersek  <[email protected]>
 
         Segmentation Fault with Romanian locale. Evolution not starting.

Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/webkit/webkitwebplugin.cpp (149996 => 149997)


--- releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/webkit/webkitwebplugin.cpp	2013-05-13 07:43:02 UTC (rev 149996)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/webkit/webkitwebplugin.cpp	2013-05-13 07:55:55 UTC (rev 149997)
@@ -63,8 +63,6 @@
     WebKitWebPlugin* plugin = WEBKIT_WEB_PLUGIN(object);
     WebKitWebPluginPrivate* priv = plugin->priv;
 
-    g_free(priv->path);
-
     g_slist_foreach(priv->mimeTypes, (GFunc)freeMIMEType, 0);
     g_slist_free(priv->mimeTypes);
 
@@ -191,23 +189,20 @@
     WebKitWebPluginPrivate* priv = plugin->priv;
 
     if (priv->path)
-        return priv->path;
+        return priv->path.get();
 
-    GError* error = 0;
-    priv->path = g_filename_from_utf8(priv->corePlugin->path().utf8().data(), -1, 0, 0, &error);
+    GOwnPtr<GError> error;
+    priv->path.set(g_filename_from_utf8(priv->corePlugin->path().utf8().data(), -1, 0, 0, &error.outPtr()));
 
     if (!error)
-        return priv->path;
+        return priv->path.get();
 
     // In the unlikely case the convertion fails, report the error and make sure we free
     // any partial convertion that ended up in the variable.
-    g_free(priv->path);
-    priv->path = 0;
+    priv->path.clear();
 
     g_warning("Failed to convert '%s' to system filename encoding: %s", priv->corePlugin->path().utf8().data(), error->message);
 
-    g_clear_error(&error);
-
     return 0;
 }
 

Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/webkit/webkitwebpluginprivate.h (149996 => 149997)


--- releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/webkit/webkitwebpluginprivate.h	2013-05-13 07:43:02 UTC (rev 149996)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit/gtk/webkit/webkitwebpluginprivate.h	2013-05-13 07:55:55 UTC (rev 149997)
@@ -21,6 +21,7 @@
 
 #include "webkitwebplugin.h"
 #include <glib-object.h>
+#include <wtf/gobject/GOwnPtr.h>
 #include <wtf/text/CString.h>
 
 namespace WebCore {
@@ -38,7 +39,7 @@
     RefPtr<WebCore::PluginPackage> corePlugin;
     CString name;
     CString description;
-    char* path;
+    GOwnPtr<char> path;
     GSList* mimeTypes;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to