aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-01-24 11:39:12 +0100
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-01-24 11:39:12 +0100
commitf02ca5a6b148d7ab6c33692da84f4601af4fd8c8 (patch)
tree6c9e28c18890ade929fb8804b1a317822df5894e
parentdb1caf23cdfb98ce99086eebe46660928b43f6e9 (diff)
downloadlibayatana-indicator-f02ca5a6b148d7ab6c33692da84f4601af4fd8c8.tar.gz
libayatana-indicator-f02ca5a6b148d7ab6c33692da84f4601af4fd8c8.tar.bz2
libayatana-indicator-f02ca5a6b148d7ab6c33692da84f4601af4fd8c8.zip
indicator-ng: check return value of g_menu_model_get_item_attribute
If it returns false, we'd use uninitialized memory.
-rw-r--r--libindicator/indicator-ng.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libindicator/indicator-ng.c b/libindicator/indicator-ng.c
index 82af030..003ec70 100644
--- a/libindicator/indicator-ng.c
+++ b/libindicator/indicator-ng.c
@@ -244,9 +244,11 @@ indicator_ng_menu_changed (GMenuModel *menu,
gchar *action;
g_clear_pointer (&self->header_action, g_free);
- g_menu_model_get_item_attribute (self->menu, 0, G_MENU_ATTRIBUTE_ACTION, "s", &action);
- if (action && g_str_has_prefix (action, "indicator."))
- self->header_action = g_strdup (action + 10);
+ if (g_menu_model_get_item_attribute (self->menu, 0, G_MENU_ATTRIBUTE_ACTION, "s", &action) &&
+ g_str_has_prefix (action, "indicator."))
+ {
+ self->header_action = g_strdup (action + 10);
+ }
popup = g_menu_model_get_item_link (self->menu, 0, G_MENU_LINK_SUBMENU);
if (popup)