summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-12-02 01:50:51 +0100
committerPablo Barciela <[email protected]>2018-12-02 01:50:51 +0100
commit9628efb30335fc08cd58bd8c51a8e84f18cf8b95 (patch)
treeccd5723e9b24db4859b5f36e76b3c37adb9da9cf
parent76d6eff17e27330431d4e1a787eea1f16744c266 (diff)
downloadmate-panel-9628efb30335fc08cd58bd8c51a8e84f18cf8b95.tar.bz2
mate-panel-9628efb30335fc08cd58bd8c51a8e84f18cf8b95.tar.xz
panel-gtk: Fix memory leaks
'g_strconcat' needs to be freed
-rw-r--r--mate-panel/libpanel-util/panel-gtk.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/mate-panel/libpanel-util/panel-gtk.c b/mate-panel/libpanel-util/panel-gtk.c
index 47cf17db..b575a7b2 100644
--- a/mate-panel/libpanel-util/panel-gtk.c
+++ b/mate-panel/libpanel-util/panel-gtk.c
@@ -183,6 +183,7 @@ GtkWidget *
panel_image_menu_item_new_from_icon (const gchar *icon_name,
const gchar *label_name)
{
+ gchar *concat;
GtkWidget *icon;
GtkStyleContext *context;
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
@@ -193,7 +194,8 @@ panel_image_menu_item_new_from_icon (const gchar *icon_name,
else
icon = gtk_image_new ();
- GtkWidget *label_menu = gtk_label_new_with_mnemonic (g_strconcat (label_name, " ", NULL));
+ concat = g_strconcat (label_name, " ", NULL);
+ GtkWidget *label_menu = gtk_label_new_with_mnemonic (concat);
GtkWidget *menuitem = gtk_menu_item_new ();
context = gtk_widget_get_style_context (GTK_WIDGET(icon_box));
@@ -210,6 +212,8 @@ panel_image_menu_item_new_from_icon (const gchar *icon_name,
g_settings_bind (icon_settings, "menus-have-icons", icon, "visible",
G_SETTINGS_BIND_GET);
+ g_free (concat);
+
return menuitem;
}
@@ -217,6 +221,7 @@ GtkWidget *
panel_image_menu_item_new_from_gicon (GIcon *gicon,
const gchar *label_name)
{
+ gchar *concat;
GtkWidget *icon;
GtkStyleContext *context;
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
@@ -227,7 +232,8 @@ panel_image_menu_item_new_from_gicon (GIcon *gicon,
else
icon = gtk_image_new ();
- GtkWidget *label_menu = gtk_label_new_with_mnemonic (g_strconcat (label_name, " ", NULL));
+ concat = g_strconcat (label_name, " ", NULL);
+ GtkWidget *label_menu = gtk_label_new_with_mnemonic (concat);
GtkWidget *menuitem = gtk_menu_item_new ();
context = gtk_widget_get_style_context (GTK_WIDGET(icon_box));
@@ -244,6 +250,8 @@ panel_image_menu_item_new_from_gicon (GIcon *gicon,
g_settings_bind (icon_settings, "menus-have-icons", icon, "visible",
G_SETTINGS_BIND_GET);
+ g_free (concat);
+
return menuitem;
}
@@ -253,9 +261,9 @@ panel_check_menu_item_new (GtkWidget *widget_check)
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
GtkWidget *menuitem = gtk_menu_item_new ();
GtkWidget *label_name = gtk_bin_get_child (GTK_BIN (widget_check));
+ gchar *concat = g_strconcat (gtk_label_get_label (GTK_LABEL (label_name)), " ", NULL);
- gtk_label_set_text_with_mnemonic (GTK_LABEL (label_name),
- g_strconcat (gtk_label_get_label (GTK_LABEL (label_name)), " ", NULL));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (label_name), concat);
gtk_widget_set_margin_start (widget_check, 2);
gtk_widget_set_margin_start (gtk_bin_get_child (GTK_BIN (widget_check)), 11);
@@ -266,5 +274,7 @@ panel_check_menu_item_new (GtkWidget *widget_check)
gtk_label_set_mnemonic_widget (GTK_LABEL (label_name), menuitem);
+ g_free (concat);
+
return menuitem;
}