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

Commit 5cd06bb6 authored by Fukai Wang's avatar Fukai Wang Committed by android-build-merger
Browse files

Add btm_free() to clean up btm properly

am: c483d6a5

Change-Id: I8e17143167c49d9b938ee7026aea94ea17a6ec79
parents b4b22ed7 c483d6a5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ extern tBTM_CB btm_cb;
 *******************************************
*/
extern void btm_init(void);
extern void btm_free(void);

/* Internal functions provided by btm_inq.cc
 ******************************************
+18 −0
Original line number Diff line number Diff line
@@ -72,3 +72,21 @@ void btm_init(void) {

  btm_dev_init(); /* Device Manager Structures & HCI_Reset */
}

/** This function is called to free dynamic memory and system resource allocated by btm_init */
void btm_free(void) {
  fixed_queue_free(btm_cb.page_queue, NULL);
  btm_cb.page_queue = NULL;

  fixed_queue_free(btm_cb.sec_pending_q, NULL);
  btm_cb.sec_pending_q = NULL;

  list_free(btm_cb.sec_dev_rec);
  btm_cb.sec_dev_rec = NULL;

  alarm_free(btm_cb.sec_collision_timer);
  btm_cb.sec_collision_timer = NULL;

  alarm_free(btm_cb.pairing_timer);
  btm_cb.pairing_timer = NULL;
}
+3 −1
Original line number Diff line number Diff line
@@ -80,11 +80,13 @@ void btu_init_core() {
 *****************************************************************************/
void btu_free_core() {
  /* Free the mandatory core stack components */
  gatt_free();

  l2c_free();

  sdp_free();

  gatt_free();
  btm_free();
}

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