diff --git a/lib/wp/policy.c b/lib/wp/policy.c index 45b8161cbaca02e18004a5bce051714a80a3e2dd..1e05cf700abeaf38defa4da73b3aec4d24fa99e8 100644 --- a/lib/wp/policy.c +++ b/lib/wp/policy.c @@ -346,7 +346,7 @@ wp_policy_notify_changed (WpPolicy *self) /** * wp_policy_find_endpoint: * @core: the #WpCore - * @props: properties of the lookup + * @props: (transfer floating): properties of the lookup * @stream_id: (out): the relevant stream id of the returned endpoint * * Calls #WpPolicyClass::find_endpoint on all policies, in order, until @@ -378,5 +378,8 @@ wp_policy_find_endpoint (WpCore *core, GVariant *props, } } + if (g_variant_is_floating (props)) + g_variant_unref (props); + return NULL; } diff --git a/modules/module-simple-policy.c b/modules/module-simple-policy.c index 44032923f5cdfa92d5c695f0cac129b72ca94036..ff3f6132fbfa691a116944a14bf5786919b34292 100644 --- a/modules/module-simple-policy.c +++ b/modules/module-simple-policy.c @@ -26,7 +26,6 @@ simple_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep) { const char *media_class = NULL; GVariantDict d; - g_autoptr (GVariant) props = NULL; g_autoptr (WpCore) core = NULL; g_autoptr (WpEndpoint) target = NULL; g_autoptr (GError) error = NULL; @@ -42,10 +41,9 @@ simple_policy_handle_endpoint (WpPolicy *policy, WpEndpoint *ep) g_variant_dict_insert (&d, "action", "s", "link"); g_variant_dict_insert (&d, "media.class", "s", "Audio/Sink"); /* TODO: more properties are needed here */ - props = g_variant_dict_end (&d); core = wp_policy_get_core (policy); - target = wp_policy_find_endpoint (core, props, &stream_id); + target = wp_policy_find_endpoint (core, g_variant_dict_end (&d), &stream_id); if (!target) { g_warning ("Could not find an Audio/Sink target endpoint\n"); /* TODO: we should kill the client, otherwise it's going to hang waiting */