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

Commit e8bf02dd authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

bta_gattc: Fix initialization and free p_q_cmd

This will prevent crash when ACL is disconnected while GATT search

Bug: 253200147
Test: atest BluetoothInstrumentationTests
Test: manual disconnect while bonding and discovering
Tag: #feature
Change-Id: If7ad51378b650b67e551f8bbec7b38d0d9c14cbd
parent 1a25b385
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ tBTA_GATTC_CLCB* bta_gattc_clcb_alloc(tGATT_IF client_if,
      p_clcb->status = GATT_SUCCESS;
      p_clcb->transport = transport;
      p_clcb->bda = remote_bda;
      p_clcb->p_q_cmd = NULL;

      p_clcb->p_rcb = bta_gattc_cl_get_regcb(client_if);

@@ -217,7 +218,9 @@ void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB* p_clcb) {
    p_srcb->gatt_database.Clear();
  }

  if (p_clcb->p_q_cmd != NULL) {
    osi_free_and_reset((void**)&p_clcb->p_q_cmd);
  }
  memset(p_clcb, 0, sizeof(tBTA_GATTC_CLCB));
}