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

Commit b221e1ed authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix crashes when GAP operation is interrupted by disconnection

Also fixes potential issue while allocating control blocks.

Test: none
Bug: 38499153
Change-Id: I5101ac97476953cdfece45c3fa9b909e38b9d2dd
parent 9a03c88c
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -87,15 +87,7 @@ tGAP_CLCB* gap_find_clcb_by_bd_addr(BD_ADDR bda) {
  return NULL;
}

/*******************************************************************************
 *
 * Function         gap_ble_find_clcb_by_conn_id
 *
 * Description      The function searches all LCB with macthing connection ID
 *
 * Returns          total number of clcb found.
 *
 ******************************************************************************/
/* returns LCB with matching connection ID, or NULL if not found */
tGAP_CLCB* gap_ble_find_clcb_by_conn_id(uint16_t conn_id) {
  uint8_t i_clcb;
  tGAP_CLCB* p_clcb = NULL;
@@ -107,7 +99,7 @@ tGAP_CLCB* gap_ble_find_clcb_by_conn_id(uint16_t conn_id) {
    }
  }

  return p_clcb;
  return NULL;
}

/*******************************************************************************
@@ -132,10 +124,10 @@ tGAP_CLCB* gap_clcb_alloc(BD_ADDR bda) {
      p_clcb->in_use = true;
      memcpy(p_clcb->bda, bda, BD_ADDR_LEN);
      p_clcb->pending_req_q = fixed_queue_new(SIZE_MAX);
      break;
      return p_clcb;
    }
  }
  return p_clcb;
  return NULL;
}

/*******************************************************************************