From 03a6f54d25e5ced0e2c682b3b29ccf8ccfedadac Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 14 May 2009 22:26:02 +0200 Subject: [PATCH] Plug a few memory leaks in MidoriView and MidoriWebSettings --- midori/midori-view.c | 9 ++++++--- midori/midori-websettings.c | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/midori/midori-view.c b/midori/midori-view.c index f60880f6..5e803d83 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -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"); } diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index b2dffb0d..d2a4e72d 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -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); } -- 2.39.5