[eog] reload: Fix memory leak in menu cleanup code
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] reload: Fix memory leak in menu cleanup code
- Date: Sat, 31 Jan 2015 15:09:20 +0000 (UTC)
commit e26f5629eb11f6dc22f6172876397b809b1bad7e
Author: Felix Riemann <friemann gnome org>
Date: Sat Jan 31 16:09:01 2015 +0100
reload: Fix memory leak in menu cleanup code
plugins/reload/eog-reload-plugin.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/plugins/reload/eog-reload-plugin.c b/plugins/reload/eog-reload-plugin.c
index c391f30..5f81151 100644
--- a/plugins/reload/eog-reload-plugin.c
+++ b/plugins/reload/eog-reload-plugin.c
@@ -173,7 +173,6 @@ eog_reload_plugin_deactivate (EogWindowActivatable *activatable)
EogReloadPlugin *plugin = EOG_RELOAD_PLUGIN (activatable);
GMenu *menu;
GMenuModel *model;
- const gchar *id;
gint i;
eog_debug (DEBUG_PLUGINS);
@@ -186,11 +185,16 @@ eog_reload_plugin_deactivate (EogWindowActivatable *activatable)
/* Remove menu entry */
model = G_MENU_MODEL (menu);
for (i = 0; i < g_menu_model_get_n_items (model); i++) {
- if (g_menu_model_get_item_attribute (model, i, "id", "s", &id)
- && g_strcmp0 (id, EOG_RELOAD_PLUGIN_MENU_ID) == 0)
- {
- g_menu_remove (menu, i);
- break;
+ gchar *id;
+ if (g_menu_model_get_item_attribute (model, i, "id", "s", &id)) {
+ const gboolean found =
+ (g_strcmp0 (id, EOG_RELOAD_PLUGIN_MENU_ID) != 0);
+ g_free (id);
+
+ if (found) {
+ g_menu_remove (menu, i);
+ break;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]