This patch removes a registered Handsfree Audio Card when the HFP remove
callback gets called.
---
 plugins/hfp_hf_bluez5.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index f22b030..26946af 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -129,6 +129,7 @@ static void hfp_disconnected_cb(gpointer user_data)
        if (hfp->card) {
                ofono_handsfree_card_remove(hfp->card);
                g_free(hfp->card);
+               hfp->card = NULL;
        }
 
        g_at_chat_unref(info->chat);
@@ -216,6 +217,12 @@ static void hfp_remove(struct ofono_modem *modem)
        if (hfp->msg)
                dbus_message_unref(hfp->msg);
 
+       if (hfp->card) {
+               ofono_handsfree_card_remove(hfp->card);
+               g_free(hfp->card);
+               hfp->card = NULL;
+       }
+
        g_at_chat_unref(info->chat);
 
        g_free(hfp);
-- 
1.7.11.7

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to