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

Commit 1d12f28e authored by Zach Johnson's avatar Zach Johnson
Browse files

🚨 memory leak 🚨 memory leak 🚨

bta_dm_search_cb.cancel_pending is only false

p_msg is only deallocated if it is sent, it is only
sent if cancel_pending is true

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I693ed9b377c5cb9f4109ed6d93071b238bcde8cd
parent a8c22b8f
Loading
Loading
Loading
Loading
+1 −11
Original line number Original line Diff line number Diff line
@@ -1752,19 +1752,9 @@ static void bta_dm_inq_results_cb(tBTM_INQ_RESULTS* p_inq, uint8_t* p_eir,
 *
 *
 ******************************************************************************/
 ******************************************************************************/
static void bta_dm_inq_cmpl_cb(void* p_result) {
static void bta_dm_inq_cmpl_cb(void* p_result) {
  tBTA_DM_MSG* p_msg = (tBTA_DM_MSG*)osi_malloc(sizeof(tBTA_DM_MSG));

  APPL_TRACE_DEBUG("%s", __func__);
  APPL_TRACE_DEBUG("%s", __func__);


  if (!bta_dm_search_cb.cancel_pending) {
  bta_dm_inq_cmpl(((tBTM_INQUIRY_CMPL*)p_result)->num_resp);
  bta_dm_inq_cmpl(((tBTM_INQUIRY_CMPL*)p_result)->num_resp);
  } else {
    bta_dm_search_cb.cancel_pending = false;
    bta_dm_search_cancel_notify();
    p_msg->hdr.event = BTA_DM_SEARCH_CMPL_EVT;
    p_msg->hdr.layer_specific = BTA_DM_API_DISCOVER_EVT;
    bta_sys_sendmsg(p_msg);
  }
}
}


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