summaryrefslogtreecommitdiff
path: root/gtk/gtkinfobar.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-02-26 14:55:20 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-02-26 15:52:19 -0500
commit88e372cd090e9cc4ee81ca368d43f8b4fc91d8a8 (patch)
tree116505f0812e72d2b947e06014881b506e1113bb /gtk/gtkinfobar.c
parentc784d5d700c7d6c03680eb21de19c8391e8ffac3 (diff)
downloadgtk+-88e372cd090e9cc4ee81ca368d43f8b4fc91d8a8.tar.gz
infobar: Avoid a memory leak in an error case
Parsing <action-widgets> could sometimes fail to free some of the data, if a nonexisting widget is referenced. Found by gcc's leak sanitizer.
Diffstat (limited to 'gtk/gtkinfobar.c')
-rw-r--r--gtk/gtkinfobar.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk/gtkinfobar.c b/gtk/gtkinfobar.c
index d34ebfd369..e2c64fb008 100644
--- a/gtk/gtkinfobar.c
+++ b/gtk/gtkinfobar.c
@@ -916,6 +916,15 @@ typedef struct
} SubParserData;
static void
+action_widget_info_free (gpointer data)
+{
+ ActionWidgetInfo *item = data;
+
+ g_free (item->name);
+ g_free (item);
+}
+
+static void
parser_start_element (GMarkupParseContext *context,
const gchar *element_name,
const gchar **names,
@@ -1096,12 +1105,9 @@ gtk_info_bar_buildable_custom_finished (GtkBuildable *buildable,
if (ad->response_id == GTK_RESPONSE_HELP)
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (info_bar->priv->action_area),
GTK_WIDGET (object), TRUE);
-
- g_free (item->name);
- g_free (item);
}
- g_slist_free (data->items);
+ g_slist_free_full (data->items, action_widget_info_free);
g_string_free (data->string, TRUE);
g_slice_free (SubParserData, data);
}