diff options
author | Felix Riemann <friemann@gnome.org> | 2015-01-31 16:17:24 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-02-01 11:06:21 -0500 |
commit | f7803704993d1b306cb46052fd58fd02a9e20a23 (patch) | |
tree | 7193ef5620711903790a8024cb67c1a72ea2cb36 /examples | |
parent | 404e2753c4f63c5a71b65f5270317f21be77a5fe (diff) | |
download | gtk+-f7803704993d1b306cb46052fd58fd02a9e20a23.tar.gz |
plugman: Fix leaking attribute string
https://bugzilla.gnome.org/show_bug.cgi?id=743770
Diffstat (limited to 'examples')
-rw-r--r-- | examples/plugman.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/plugman.c b/examples/plugman.c index e9c052a9eb..53f502e3e3 100644 --- a/examples/plugman.c +++ b/examples/plugman.c @@ -267,16 +267,19 @@ disable_plugin (const gchar *name) plugin_menu = find_plugin_menu (); if (plugin_menu) { - const gchar *id; gint i; for (i = 0; i < g_menu_model_get_n_items (plugin_menu); i++) { - if (g_menu_model_get_item_attribute (plugin_menu, i, "id", "s", &id) && - g_strcmp0 (id, name) == 0) + gchar *id; + if (g_menu_model_get_item_attribute (plugin_menu, i, "id", "s", &id)) { - g_menu_remove (G_MENU (plugin_menu), i); - g_print ("Menus of '%s' plugin removed\n", name); + if (g_strcmp0 (id, name) == 0) + { + g_menu_remove (G_MENU (plugin_menu), i); + g_print ("Menus of '%s' plugin removed\n", name); + } + g_free (id); } } } |