aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-06-27 21:43:13 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-06-27 21:43:13 -0500
commitcc57405ebf537239ab2953b41b27908b6dadfbeb (patch)
treee0765220bda846891c5aee1ff2180b6fe8a8b4fe
parent4c5a5e7146a878a17239e44ce2debffb5b525bf1 (diff)
downloadayatana-indicator-session-cc57405ebf537239ab2953b41b27908b6dadfbeb.tar.gz
ayatana-indicator-session-cc57405ebf537239ab2953b41b27908b6dadfbeb.tar.bz2
ayatana-indicator-session-cc57405ebf537239ab2953b41b27908b6dadfbeb.zip
in actions.c's my_can_prompt(), don't leak the string returned by g_dbus_proxy_get_name_owner
-rw-r--r--src/backend-dbus/actions.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c
index 3f0e6ec..67fe9f1 100644
--- a/src/backend-dbus/actions.c
+++ b/src/backend-dbus/actions.c
@@ -326,11 +326,18 @@ my_can_hibernate (IndicatorSessionActions * self)
static gboolean
my_can_prompt (IndicatorSessionActions * self)
{
+ gboolean can_prompt = FALSE;
const priv_t * p = INDICATOR_SESSION_ACTIONS_DBUS(self)->priv;
- return (p != NULL)
- && (p->end_session_dialog != NULL)
- && (g_dbus_proxy_get_name_owner (G_DBUS_PROXY(p->end_session_dialog)) != NULL);
+ if (p && p->end_session_dialog)
+ {
+ GDBusProxy * proxy = G_DBUS_PROXY (p->end_session_dialog);
+ char * name = g_dbus_proxy_get_name_owner (proxy);
+ can_prompt = name != NULL;
+ g_free (name);
+ }
+
+ return can_prompt;
}
static gboolean