diff --git a/components/bt/host/bluedroid/stack/btm/btm_acl.c b/components/bt/host/bluedroid/stack/btm/btm_acl.c index 2c82cc283f..58f6f21b8e 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_acl.c +++ b/components/bt/host/bluedroid/stack/btm/btm_acl.c @@ -509,12 +509,14 @@ void btm_acl_device_down (void) { tACL_CONN *p = NULL; BTM_TRACE_DEBUG ("btm_acl_device_down\n"); - for (list_node_t *p_node = list_begin(btm_cb.p_acl_db_list); p_node; p_node = list_next(p_node)) { - p = list_node(p_node); - if (p && p->in_use) { - BTM_TRACE_DEBUG ("hci_handle=%d HCI_ERR_HW_FAILURE \n", p->hci_handle ); - l2c_link_hci_disc_comp (p->hci_handle, HCI_ERR_HW_FAILURE); - } + for (list_node_t *p_node = list_begin(btm_cb.p_acl_db_list); p_node;) { + list_node_t *p_next = list_next(p_node); + p = list_node(p_node); + if (p && p->in_use) { + BTM_TRACE_DEBUG ("hci_handle=%d HCI_ERR_HW_FAILURE \n", p->hci_handle ); + l2c_link_hci_disc_comp (p->hci_handle, HCI_ERR_HW_FAILURE); + } + p_node = p_next; } } /*******************************************************************************