summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--daemon/dbus/gkd-secret-change.c13
-rw-r--r--daemon/dbus/gkd-secret-create.c1
-rw-r--r--daemon/gpg-agent/gkd-gpg-agent-ops.c4
3 files changed, 9 insertions, 9 deletions
diff --git a/daemon/dbus/gkd-secret-change.c b/daemon/dbus/gkd-secret-change.c
index 4afb489d..10a0725d 100644
--- a/daemon/dbus/gkd-secret-change.c
+++ b/daemon/dbus/gkd-secret-change.c
@@ -454,26 +454,27 @@ gkd_secret_change_with_secrets (GckObject *collection,
gck_builder_add_boolean (&builder, CKA_TOKEN, FALSE);
attrs = gck_attributes_ref_sink (gck_builder_end (&builder));
mcred = gkd_secret_session_create_credential (master->session, session, attrs, master, error);
- if (mcred == NULL)
- goto cleanup;
-
gck_builder_add_all (&builder, attrs);
gck_attributes_unref (attrs);
+ if (mcred == NULL)
+ goto cleanup;
+
/* Create the original credential, in order to make sure we can the collection */
if (original) {
gck_builder_add_ulong (&builder, CKA_G_OBJECT, gck_object_get_handle (collection));
attrs = gck_attributes_ref_sink (gck_builder_end (&builder));
ocred = gkd_secret_session_create_credential (original->session, session, attrs, original, error);
+ gck_attributes_unref (attrs);
+
if (ocred == NULL)
goto cleanup;
}
- gck_attributes_unref (attrs);
gck_builder_add_ulong (&builder, CKA_G_CREDENTIAL, gck_object_get_handle (mcred));
/* Now set the collection credentials to the first one */
- result = gck_object_set (collection, attrs, NULL, error);
+ result = gck_object_set (collection, gck_builder_end (&builder), NULL, error);
cleanup:
if (ocred) {
@@ -488,6 +489,6 @@ cleanup:
g_object_unref (mcred);
}
- gck_attributes_unref (attrs);
+ gck_builder_clear (&builder);
return result;
}
diff --git a/daemon/dbus/gkd-secret-create.c b/daemon/dbus/gkd-secret-create.c
index b7009312..2c8c9f52 100644
--- a/daemon/dbus/gkd-secret-create.c
+++ b/daemon/dbus/gkd-secret-create.c
@@ -457,7 +457,6 @@ gkd_secret_create_with_secret (GckAttributes *attrs,
collection = gkd_secret_create_with_credential (session, attrs, cred, error);
- gck_attributes_unref (atts);
g_object_unref (cred);
if (collection == NULL)
diff --git a/daemon/gpg-agent/gkd-gpg-agent-ops.c b/daemon/gpg-agent/gkd-gpg-agent-ops.c
index 154e1725..8f4e7efd 100644
--- a/daemon/gpg-agent/gkd-gpg-agent-ops.c
+++ b/daemon/gpg-agent/gkd-gpg-agent-ops.c
@@ -199,15 +199,15 @@ do_save_password (GckSession *session, const gchar *keyid, const gchar *descript
gck_list_unref_free (previous);
}
- gck_attributes_unref (attrs);
-
text = calculate_label_for_key (keyid, description);
label = g_strdup_printf (_("PGP Key: %s"), text);
g_free (text);
/* Put in the remainder of the attributes */
+ gck_builder_add_all (&builder, attrs);
gck_builder_add_string (&builder, CKA_VALUE, password);
gck_builder_add_string (&builder, CKA_LABEL, label);
+ gck_attributes_unref (attrs);
g_free (label);
item = gck_session_create_object (session, gck_builder_end (&builder), NULL, &error);