secret-session: Avoid double-free in service_encode_plain_secret()

As g_variant_builder_add_value() takes ownership of a floating
GVariant, we don't need to unref it afterwards.
This commit is contained in:
Daiki Ueno 2018-07-20 10:57:14 +02:00
parent 83774b8b93
commit 9ca8f323a9

View File

@ -612,12 +612,10 @@ service_encode_plain_secret (SecretSession *session,
child = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), "", 0, TRUE, NULL, NULL); child = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), "", 0, TRUE, NULL, NULL);
g_variant_builder_add_value (builder, child); g_variant_builder_add_value (builder, child);
g_variant_unref (child);
child = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), secret, n_secret, TRUE, child = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), secret, n_secret, TRUE,
secret_value_unref, secret_value_ref (value)); secret_value_unref, secret_value_ref (value));
g_variant_builder_add_value (builder, child); g_variant_builder_add_value (builder, child);
g_variant_unref (child);
g_variant_builder_add (builder, "s", secret_value_get_content_type (value)); g_variant_builder_add (builder, "s", secret_value_get_content_type (value));
return TRUE; return TRUE;