diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-06-27 21:44:03 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-06-27 21:44:03 -0500 |
commit | b6467f327dcfc2c4fb60b57f293747259d0b7228 (patch) | |
tree | 3596bd4cb372b1a276f39a8078f81c1cc1b2c677 /src | |
parent | cc57405ebf537239ab2953b41b27908b6dadfbeb (diff) | |
download | ayatana-indicator-session-b6467f327dcfc2c4fb60b57f293747259d0b7228.tar.gz ayatana-indicator-session-b6467f327dcfc2c4fb60b57f293747259d0b7228.tar.bz2 ayatana-indicator-session-b6467f327dcfc2c4fb60b57f293747259d0b7228.zip |
in create_guest_switcher_state() and create_user_switcher_state(), don't leak GVariantBuilders
Diffstat (limited to 'src')
-rw-r--r-- | src/service.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/service.c b/src/service.c index d8fc961..931c626 100644 --- a/src/service.c +++ b/src/service.c @@ -311,15 +311,15 @@ static GVariant * create_guest_switcher_state (IndicatorSessionService * self) { GVariant * val; - GVariantBuilder * b; + GVariantBuilder b; IndicatorSessionGuest * const g = self->priv->backend_guest; - b = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_init (&b, G_VARIANT_TYPE ("a{sv}")); val = g_variant_new_boolean (indicator_session_guest_is_active (g)); - g_variant_builder_add (b, "{sv}", "is-active", val); + g_variant_builder_add (&b, "{sv}", "is-active", val); val = g_variant_new_boolean (indicator_session_guest_is_logged_in (g)); - g_variant_builder_add (b, "{sv}", "is-logged-in", val); - return g_variant_builder_end (b); + g_variant_builder_add (&b, "{sv}", "is-logged-in", val); + return g_variant_builder_end (&b); } /** @@ -330,15 +330,15 @@ create_guest_switcher_state (IndicatorSessionService * self) static GVariant * create_user_switcher_state (IndicatorSessionService * self) { - GVariantBuilder * a; - GVariantBuilder * b; + GVariantBuilder a; + GVariantBuilder b; GVariant * val; GHashTableIter ht_iter; gpointer ht_value; const char * current_user; current_user = ""; - a = g_variant_builder_new (G_VARIANT_TYPE("as")); + g_variant_builder_init (&a, G_VARIANT_TYPE("as")); g_hash_table_iter_init (&ht_iter, self->priv->users); while (g_hash_table_iter_next (&ht_iter, NULL, &ht_value)) { @@ -348,15 +348,15 @@ create_user_switcher_state (IndicatorSessionService * self) current_user = u->user_name; if (u->is_logged_in) - g_variant_builder_add (a, "s", u->user_name); + g_variant_builder_add (&a, "s", u->user_name); } - b = g_variant_builder_new (G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init (&b, G_VARIANT_TYPE("a{sv}")); val = g_variant_new_string (current_user); - g_variant_builder_add (b, "{sv}", "active-user", val); - val = g_variant_builder_end (a); - g_variant_builder_add (b, "{sv}", "logged-in-users", val); - return g_variant_builder_end (b); + g_variant_builder_add (&b, "{sv}", "active-user", val); + val = g_variant_builder_end (&a); + g_variant_builder_add (&b, "{sv}", "logged-in-users", val); + return g_variant_builder_end (&b); } static void |