From ca5c4991f7815f9b5190b370bfa70c651facaf72 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Sat, 25 Aug 2012 16:38:19 +0200 Subject: Plug memory leaks: return value of g_menu_model_get_item_link is transfer full --- src/gmenuutils.c | 10 +++++++++- src/messages-service.c | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gmenuutils.c b/src/gmenuutils.c index f3ceba7..f63615b 100644 --- a/src/gmenuutils.c +++ b/src/gmenuutils.c @@ -40,7 +40,15 @@ g_menu_find_section (GMenu *menu, n_items = g_menu_model_get_n_items (model); for (i = 0; i < n_items; i++) { - if (section == g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION)) + GMenuModel *link; + gboolean found; + + link = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION); + found = section == link; + + g_object_unref (link); + + if (found) return i; } diff --git a/src/messages-service.c b/src/messages-service.c index db7a8d7..31d2a5b 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -134,6 +134,8 @@ uses_chat_status_changed (GObject *object, if (show_chat) g_menu_insert_section (menu, 0, NULL, chat_section); } + + g_object_unref (first_section); } static AppSection * -- cgit v1.2.3