summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2014-11-14 13:43:33 -0800
committerCosimo Cecchi <cosimoc@gnome.org>2015-06-29 09:04:03 -0700
commit5d6c9d37c1adf1414a3b63a2a2a1cc764591caf6 (patch)
tree863fb7b8d96eeb796478545e042484fa71fb7c5f /daemon
parent3d91423537093cbc2814a7278e1cb8311202eeaa (diff)
downloadgnome-keyring-5d6c9d37c1adf1414a3b63a2a2a1cc764591caf6.tar.gz
dbus: plug some memory leaks
Diffstat (limited to 'daemon')
-rw-r--r--daemon/dbus/gkd-dbus-session.c45
-rw-r--r--daemon/dbus/gkd-secret-property.c8
2 files changed, 32 insertions, 21 deletions
diff --git a/daemon/dbus/gkd-dbus-session.c b/daemon/dbus/gkd-dbus-session.c
index e979aa10..8d5033cd 100644
--- a/daemon/dbus/gkd-dbus-session.c
+++ b/daemon/dbus/gkd-dbus-session.c
@@ -43,31 +43,36 @@ send_end_session_response (GDBusConnection *conn)
const gchar *reason = "";
gboolean is_ok = TRUE;
GError *error = NULL;
+ GVariant *res;
g_return_if_fail (client_session_path);
- g_dbus_connection_call_sync (conn,
- SERVICE_SESSION_MANAGER,
- client_session_path,
- IFACE_SESSION_PRIVATE,
- "EndSessionResponse",
- g_variant_new ("(bs)",
- is_ok,
- reason),
- NULL,
- G_DBUS_CALL_FLAGS_NONE, 1000,
- NULL, &error);
+ res = g_dbus_connection_call_sync (conn,
+ SERVICE_SESSION_MANAGER,
+ client_session_path,
+ IFACE_SESSION_PRIVATE,
+ "EndSessionResponse",
+ g_variant_new ("(bs)",
+ is_ok,
+ reason),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE, 1000,
+ NULL, &error);
if (error != NULL) {
g_message ("dbus failure responding to ending session: %s", error->message);
g_error_free (error);
return;
}
+
+ g_variant_unref (res);
}
static void
unregister_daemon_in_session (GDBusConnection *conn)
{
+ GVariant *res;
+
if (client_session_signal_id) {
g_dbus_connection_signal_unsubscribe (conn, client_session_signal_id);
client_session_signal_id = 0;
@@ -76,17 +81,19 @@ unregister_daemon_in_session (GDBusConnection *conn)
if (!client_session_path)
return;
- g_dbus_connection_call_sync (conn,
- SERVICE_SESSION_MANAGER,
- PATH_SESSION_MANAGER,
- IFACE_SESSION_MANAGER,
- "UnregisterClient",
- g_variant_new ("(o)", client_session_path),
- NULL, G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, NULL);
+ res = g_dbus_connection_call_sync (conn,
+ SERVICE_SESSION_MANAGER,
+ PATH_SESSION_MANAGER,
+ IFACE_SESSION_MANAGER,
+ "UnregisterClient",
+ g_variant_new ("(o)", client_session_path),
+ NULL, G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, NULL);
g_free (client_session_path);
client_session_path = NULL;
+
+ g_clear_pointer (&res, g_variant_unref);
}
static void
diff --git a/daemon/dbus/gkd-secret-property.c b/daemon/dbus/gkd-secret-property.c
index 9c30d808..3be7f6a2 100644
--- a/daemon/dbus/gkd-secret-property.c
+++ b/daemon/dbus/gkd-secret-property.c
@@ -457,14 +457,18 @@ gkd_secret_property_parse_all (GVariant *array,
g_variant_iter_init (&iter, array);
- while (g_variant_iter_loop (&iter, "{sv}", &name, &variant)) {
+ while (g_variant_iter_next (&iter, "{&sv}", &name, &variant)) {
/* Property interface.name */
if (!property_to_attribute (name, interface, &attr_type, &data_type))
return FALSE;
/* Property value */
- if (!iter_get_variant (variant, data_type, attr_type, builder))
+ if (!iter_get_variant (variant, data_type, attr_type, builder)) {
+ g_variant_unref (variant);
return FALSE;
+ }
+
+ g_variant_unref (variant);
}
return TRUE;