secret-paths: Make sure to unref GVariant

The GVariant returned in
secret_service_get_secret{,s}_for_dbus_path{,s}_finish should be
unref'ed after use.

Signed-off-by: Daiki Ueno <dueno@src.gnome.org>
This commit is contained in:
Daiki Ueno 2023-10-19 13:50:12 +09:00
parent e9818571e3
commit 92705b58a3

View File

@ -783,6 +783,7 @@ secret_service_get_secret_for_dbus_path_finish (SecretService *self,
GError **error) GError **error)
{ {
GVariant *ret; GVariant *ret;
SecretValue *value;
g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_is_valid (result, self), NULL);
@ -796,7 +797,9 @@ secret_service_get_secret_for_dbus_path_finish (SecretService *self,
return NULL; return NULL;
} }
return _secret_service_decode_get_secrets_first (self, ret); value = _secret_service_decode_get_secrets_first (self, ret);
g_variant_unref (ret);
return value;
} }
/** /**
@ -920,6 +923,7 @@ secret_service_get_secrets_for_dbus_paths_finish (SecretService *self,
GError **error) GError **error)
{ {
GVariant *ret; GVariant *ret;
GHashTable *values;
g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL); g_return_val_if_fail (SECRET_IS_SERVICE (self), NULL);
g_return_val_if_fail (g_task_is_valid (result, self), NULL); g_return_val_if_fail (g_task_is_valid (result, self), NULL);
@ -933,7 +937,9 @@ secret_service_get_secrets_for_dbus_paths_finish (SecretService *self,
return NULL; return NULL;
} }
return _secret_service_decode_get_secrets_all (self, ret); values = _secret_service_decode_get_secrets_all (self, ret);
g_variant_unref (ret);
return values;
} }
/** /**