Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c71c23db authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Fix crashes in btm_consolidate_dev

am: 8ec8b8c3

Change-Id: I177f816de4f982936af371463ce60f7c1ac9432c
parents e27959d8 8ec8b8c3
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -384,11 +384,14 @@ void btm_consolidate_dev(tBTM_SEC_DEV_REC* p_target_rec) {
  BTM_TRACE_DEBUG("%s", __func__);
  BTM_TRACE_DEBUG("%s", __func__);


  list_node_t* end = list_end(btm_cb.sec_dev_rec);
  list_node_t* end = list_end(btm_cb.sec_dev_rec);
  for (list_node_t* node = list_begin(btm_cb.sec_dev_rec); node != end;
  list_node_t* node = list_begin(btm_cb.sec_dev_rec);
       node = list_next(node)) {
  while (node != end) {
    tBTM_SEC_DEV_REC* p_dev_rec =
    tBTM_SEC_DEV_REC* p_dev_rec =
        static_cast<tBTM_SEC_DEV_REC*>(list_node(node));
        static_cast<tBTM_SEC_DEV_REC*>(list_node(node));


    // we do list_remove in some cases, must grab next before removing
    node = list_next(node);

    if (p_target_rec == p_dev_rec) continue;
    if (p_target_rec == p_dev_rec) continue;


    if (p_dev_rec->bd_addr == p_target_rec->bd_addr) {
    if (p_dev_rec->bd_addr == p_target_rec->bd_addr) {