Resolved the GAP Agent re-registration Failure
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-hfp.c
index fffbf5f..7e1dee8 100644 (file)
@@ -50,24 +50,24 @@ const bt_interface_t * _bt_get_stack_interface(void);
 static const bthf_interface_t *blued_hfp_interface = NULL;
 
 static bthf_callbacks_t blued_hf_cb = {
-       sizeof(blued_hf_cb),
-       cb_hfp_connection_state,
-       cb_hfp_audio_connection_state,
-       NULL, /* vr_cmd_cb */
-       NULL, /* answer_call_cmd_cb */
-       NULL, /* hangup_call_cmd_cb */
-       NULL, /* volume_cmd_cb */
-       NULL, /* dial_call_cmd_cb */
-       NULL, /* dtmf_cmd_cb */
-       NULL, /* nrec_cmd_cb */
-       NULL, /* wbs_cb */
-       NULL, /* chld_cmd_cb */
-       NULL, /* cnum_cmd_cb */
-       NULL, /* cind_cmd_cb */
-       NULL, /* cops_cmd_cb */
-       NULL, /* clcc_cmd_cb */
-       NULL, /* unknown_at_cmd_cb */
-       NULL  /* key_pressed_cmd_cb */
+       .size = sizeof(blued_hf_cb),
+       .connection_state_cb = cb_hfp_connection_state,
+       .audio_state_cb = cb_hfp_audio_connection_state,
+       .vr_cmd_cb = NULL,
+       .answer_call_cmd_cb = NULL,
+       .hangup_call_cmd_cb = NULL,
+       .volume_cmd_cb = NULL,
+       .dial_call_cmd_cb = NULL,
+       .dtmf_cmd_cb = NULL,
+       .nrec_cmd_cb = NULL,
+       .wbs_cb = NULL,
+       .chld_cmd_cb = NULL,
+       .cnum_cmd_cb = NULL,
+       .cind_cmd_cb = NULL,
+       .cops_cmd_cb = NULL,
+       .clcc_cmd_cb = NULL,
+       .unknown_at_cmd_cb = NULL,
+       .key_pressed_cmd_cb = NULL
 };
 
 oal_status_t hfp_enable(int max_hf_clients_supported)
@@ -217,6 +217,8 @@ static void cb_hfp_connection_state(bthf_connection_state_t state, bt_bdaddr_t *
 
        if (bd_addr == NULL) {
                BT_ERR("Address is NULL");
+               if (event_data)
+                       g_free(event_data);
                return;
        }
 
@@ -240,6 +242,8 @@ static void cb_hfp_connection_state(bthf_connection_state_t state, bt_bdaddr_t *
        }
        default: {
                BT_INFO("Invalid state");
+               if (event_data)
+                       g_free(event_data);
                return;
        }
        }
@@ -256,6 +260,8 @@ static void cb_hfp_audio_connection_state(bthf_audio_state_t state, bt_bdaddr_t
 
        if (bd_addr == NULL) {
                BT_ERR("Address is NULL");
+               if (event_data)
+                       g_free(event_data);
                return;
        }
        BT_INFO("HFP Audio state = [%d],  BT Address = [%s]", state, bdt_bd2str((bt_address_t*)bd_addr, &bdstr));
@@ -283,6 +289,8 @@ static void cb_hfp_audio_connection_state(bthf_audio_state_t state, bt_bdaddr_t
        }
        default: {
                BT_INFO("Invalid state");
+               if (event_data)
+                       g_free(event_data);
                return;
        }
        }