diff options
author | Denis Gorodnichev <[email protected]> | 2014-02-21 16:58:58 +0400 |
---|---|---|
committer | Denis Gorodnichev <[email protected]> | 2014-02-21 17:09:28 +0400 |
commit | 328c01a32417c802457161b0a916b57b35635ea6 (patch) | |
tree | 1ee8640af3bfe7acff602200613f135e37b94e60 | |
parent | da3ae79722e7dde4fa99134ea2b9ad0cea014a63 (diff) | |
download | mate-panel-328c01a32417c802457161b0a916b57b35635ea6.tar.bz2 mate-panel-328c01a32417c802457161b0a916b57b35635ea6.tar.xz |
memory leaks
g_settings_get_string returns newly-allocated string
-rw-r--r-- | mate-panel/drawer.c | 10 | ||||
-rw-r--r-- | mate-panel/panel-addto.c | 4 | ||||
-rw-r--r-- | mate-panel/panel-bindings.c | 8 | ||||
-rw-r--r-- | mate-panel/panel-menu-button.c | 15 | ||||
-rw-r--r-- | mate-panel/panel-profile.c | 10 |
5 files changed, 31 insertions, 16 deletions
diff --git a/mate-panel/drawer.c b/mate-panel/drawer.c index 6961343f..2b8f4815 100644 --- a/mate-panel/drawer.c +++ b/mate-panel/drawer.c @@ -304,6 +304,7 @@ set_tooltip_and_name (Drawer *drawer, const char *tooltip) { g_return_if_fail (drawer != NULL); + g_return_if_fail (drawer->toplevel != NULL); g_return_if_fail (tooltip != NULL); if (tooltip && !tooltip [0]) @@ -438,7 +439,7 @@ panel_drawer_custom_icon_changed (GSettings *settings, gchar *key, Drawer *drawer) { - const char *custom_icon; + char *custom_icon; custom_icon = g_settings_get_string (settings, key); if (custom_icon && custom_icon [0]) { @@ -447,6 +448,8 @@ panel_drawer_custom_icon_changed (GSettings *settings, if (use_custom_icon) button_widget_set_icon_name (BUTTON_WIDGET (drawer->button), custom_icon); } + + g_free (custom_icon); } static void @@ -454,8 +457,9 @@ panel_drawer_tooltip_changed (GSettings *settings, gchar *key, Drawer *drawer) { - set_tooltip_and_name (drawer, - g_settings_get_string (settings, key)); + gchar *tooltip = g_settings_get_string (settings, key); + set_tooltip_and_name (drawer, tooltip); + g_free (tooltip); } static void diff --git a/mate-panel/panel-addto.c b/mate-panel/panel-addto.c index 12f30dca..6535ba3b 100644 --- a/mate-panel/panel-addto.c +++ b/mate-panel/panel-addto.c @@ -1036,7 +1036,9 @@ panel_addto_name_notify (GSettings *settings, gchar *key, PanelAddtoDialog *dialog) { - panel_addto_name_change (dialog, g_settings_get_string (settings, key)); + gchar *name = g_settings_get_string (settings, key); + panel_addto_name_change (dialog, name); + g_free (name); } static gboolean diff --git a/mate-panel/panel-bindings.c b/mate-panel/panel-bindings.c index a5c2530b..65f0b7e3 100644 --- a/mate-panel/panel-bindings.c +++ b/mate-panel/panel-bindings.c @@ -132,7 +132,9 @@ panel_binding_changed (GSettings *settings, binding->keyval = 0; binding->modifiers = 0; - panel_binding_set_from_string (binding, g_settings_get_string (settings, key)); + gchar *value = g_settings_get_string (settings, key); + panel_binding_set_from_string (binding, value); + g_free (value); if (!binding->keyval) return; @@ -177,7 +179,9 @@ panel_bindings_mouse_modifier_changed (GSettings *settings, gchar *key, gpointer user_data) { - panel_bindings_mouse_modifier_set_from_string (g_settings_get_string (settings, key)); + gchar *value = g_settings_get_string (settings, key); + panel_bindings_mouse_modifier_set_from_string (value); + g_free (value); } static void diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c index 7976ae60..4b2c8402 100644 --- a/mate-panel/panel-menu-button.c +++ b/mate-panel/panel-menu-button.c @@ -584,14 +584,17 @@ panel_menu_button_gsettings_notify (GSettings *settings, PanelMenuButton *button) { if (!strcmp (key, PANEL_OBJECT_MENU_PATH_KEY)) { - panel_menu_button_set_menu_path (button, - g_settings_get_string (settings, key)); + gchar *value = g_settings_get_string (settings, key); + panel_menu_button_set_menu_path (button, value); + g_free (value); } else if (!strcmp (key, PANEL_OBJECT_CUSTOM_ICON_KEY)) { - panel_menu_button_set_custom_icon (button, - g_settings_get_string (settings, key)); + gchar *value = g_settings_get_string (settings, key); + panel_menu_button_set_custom_icon (button, value); + g_free (value); } else if (!strcmp (key, PANEL_OBJECT_TOOLTIP_KEY)) { - panel_menu_button_set_tooltip (button, - g_settings_get_string (settings, key)); + gchar *value = g_settings_get_string (settings, key); + panel_menu_button_set_tooltip (button, value); + g_free (value); } else if (!strcmp (key, PANEL_OBJECT_USE_MENU_PATH_KEY)) { panel_menu_button_set_use_menu_path (button, g_settings_get_boolean (settings, key)); diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c index b5504a7e..f6299af8 100644 --- a/mate-panel/panel-profile.c +++ b/mate-panel/panel-profile.c @@ -784,8 +784,9 @@ panel_profile_toplevel_change_notify (GSettings *settings, #define UPDATE_STRING(k, n) \ if (!strcmp (key, k)) { \ - panel_toplevel_set_##n (toplevel, \ - g_settings_get_string (settings, key)); \ + gchar *value = g_settings_get_string (settings, key); \ + panel_toplevel_set_##n (toplevel, value); \ + g_free (value); \ } #define UPDATE_ENUM(k, n) \ @@ -915,8 +916,9 @@ panel_profile_background_change_notify (GSettings *settings, panel_background_set_opacity (background, g_settings_get_int (settings, key)); } else if (!strcmp (key, "image")) { - panel_background_set_image (background, - g_settings_get_string (settings, key)); + gchar *value = g_settings_get_string (settings, key); + panel_background_set_image (background, value); + g_free (value); } else if (!strcmp (key, "fit")) { panel_background_set_fit (background, g_settings_get_boolean (settings, key)); |