[pulseaudio-discuss] [RFCv0 17/21] bluetooth: Implement org.ofono.HandsfreeAudioAgent.Release()

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Sun Jun 1 03:20:45 PDT 2014


On Tue, 2014-02-04 at 19:04 -0300, jprvita at gmail.com wrote:
> From: João Paulo Rechi Vita <jprvita at openbossa.org>
> 
> ---
>  src/modules/bluetooth/hfaudioagent-ofono.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/src/modules/bluetooth/hfaudioagent-ofono.c b/src/modules/bluetooth/hfaudioagent-ofono.c
> index 6a26367..423e42a 100644
> --- a/src/modules/bluetooth/hfaudioagent-ofono.c
> +++ b/src/modules/bluetooth/hfaudioagent-ofono.c
> @@ -487,7 +487,20 @@ static DBusMessage *hf_audio_agent_release(DBusConnection *c, DBusMessage *m, vo
>          return r;
>      }
>  
> -    r = dbus_message_new_error(m, "org.ofono.Error.NotImplemented", "Operation is not implemented");
> +    pa_log_debug("HF audio agent has been unregistered by oFono (%s)", hfdata->ofono_bus_id);
> +
> +    if (hfdata->hf_audio_cards) {
> +        pa_hashmap_free(hfdata->hf_audio_cards);
> +        hfdata->hf_audio_cards = NULL;
> +    }

Instead of freeing the hashmap, it's better to just empty its contents
with pa_hashmap_remove_all().

> +
> +    if(hfdata->ofono_bus_id) {
> +        pa_xfree(hfdata->ofono_bus_id);
> +        hfdata->ofono_bus_id = NULL;
> +    }

No need to use if here. pa_xfree() can be called uncoditionally.

-- 
Tanu



More information about the pulseaudio-discuss mailing list