]> spindle.queued.net Git - midori/commitdiff
Plug a few memory leaks in MidoriView and MidoriWebSettings
authorChristian Dywan <christian@twotoasts.de>
Thu, 14 May 2009 20:26:02 +0000 (22:26 +0200)
committerChristian Dywan <christian@twotoasts.de>
Thu, 14 May 2009 20:26:02 +0000 (22:26 +0200)
midori/midori-view.c
midori/midori-websettings.c

index f60880f6717f54d687b21e7a2b64ae7325d3477b..5e803d83292fcaff40e02faa8c7f302f2ac55695 100644 (file)
@@ -539,7 +539,10 @@ midori_view_update_icon (MidoriView* view,
         {
             icon_theme = gtk_icon_theme_get_for_screen (screen);
             if ((parts = g_strsplit (view->mime_type, "/", 2)))
-                parts = (parts[0] && parts[1]) ? parts : NULL;
+            {
+                if (!(parts[0] && parts[1]))
+                    katze_assign (parts, NULL);
+            }
         }
         else
             parts = NULL;
@@ -780,8 +783,8 @@ webkit_web_view_load_finished_cb (WebKitWebView*  web_view,
             g_strfreev (parts);
         }
         g_strfreev (items);
-        g_object_set_data (G_OBJECT (view), "news-feeds",
-                           value && *value ? (void*)1 : (void*)0);
+        g_object_set_data_full (G_OBJECT (view), "news-feeds",
+                           value && *value ? (void*)1 : (void*)0, g_free);
         /* Ensure load-status is notified again, whether it changed or not */
         g_object_notify (G_OBJECT (view), "load-status");
     }
index b2dffb0d6d6c2236431f747b19cb97a1688732f5..d2a4e72da2f7d02e8c341cf79ec244b464ee3379 100644 (file)
@@ -954,7 +954,7 @@ notify_default_encoding_cb (GObject*    object,
                             GParamSpec* pspec)
 {
     MidoriWebSettings* web_settings;
-    const gchar* string;
+    gchar* string;
     const gchar* encoding;
 
     web_settings = MIDORI_WEB_SETTINGS (object);
@@ -973,6 +973,7 @@ notify_default_encoding_cb (GObject*    object,
         web_settings->preferred_encoding = MIDORI_ENCODING_WESTERN;
     else
         web_settings->preferred_encoding = MIDORI_ENCODING_CUSTOM;
+    g_free (string);
     g_object_notify (object, "preferred-encoding");
 }
 
@@ -994,6 +995,20 @@ midori_web_settings_init (MidoriWebSettings* web_settings)
 static void
 midori_web_settings_finalize (GObject* object)
 {
+    MidoriWebSettings* web_settings;
+
+    web_settings = MIDORI_WEB_SETTINGS (object);
+
+    katze_assign (web_settings->toolbar_items, NULL);
+    katze_assign (web_settings->homepage, NULL);
+    katze_assign (web_settings->download_folder, NULL);
+    katze_assign (web_settings->download_manager, NULL);
+    katze_assign (web_settings->text_editor, NULL);
+    katze_assign (web_settings->news_aggregator, NULL);
+    katze_assign (web_settings->location_entry_search, NULL);
+    katze_assign (web_settings->http_proxy, NULL);
+    katze_assign (web_settings->ident_string, NULL);
+
     G_OBJECT_CLASS (midori_web_settings_parent_class)->finalize (object);
 }