🚨 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
diff --git a/system/bta/dm/bta_dm_act.cc b/system/bta/dm/bta_dm_act.cc
index 5951fe0..9e928f4 100644
--- a/system/bta/dm/bta_dm_act.cc
+++ b/system/bta/dm/bta_dm_act.cc
@@ -1752,19 +1752,9 @@
  *
  ******************************************************************************/
 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__);
 
-  if (!bta_dm_search_cb.cancel_pending) {
-    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);
-  }
+  bta_dm_inq_cmpl(((tBTM_INQUIRY_CMPL*)p_result)->num_resp);
 }
 
 /*******************************************************************************