RFCOMM socket : free connection info before sending callback
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-rfcomm-client.c
index 099816e..58cf81f 100644 (file)
@@ -269,15 +269,14 @@ static void _bt_rfcomm_disconnect_conn_info(rfcomm_conn_info_t *conn_info,
        BT_DBG("Disconnection Result[%d] BT_ADDRESS[%s] UUID[%s] FD[%d]",
                        BLUETOOTH_ERROR_NONE, conn_info->bt_addr,
                        info->uuid, conn_info->fd);
-       _bt_common_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
-                       BLUETOOTH_ERROR_NONE, &disconn_info,
-                       event_info->cb, event_info->user_data);
-
        __rfcomm_remove_conn_info_t(info, conn_info->bt_addr);
-
        if (info->rfcomm_conns == NULL)
                rfcomm_cb_data_remove(info);
 
+       _bt_common_event_cb(BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,
+                       BLUETOOTH_ERROR_NONE, &disconn_info,
+                       event_info->cb, event_info->user_data);
+
        BT_DBG("-");
 }