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

Commit 0a627827 authored by Chris Manton's avatar Chris Manton
Browse files

Add stack/btm/btm_main::btm_free

Towards life cycle aware code

Bug: 174401900
Tag: #refactor
Test: gd/cert/run --host

Change-Id: I71d8c1dc32b6ca3b94b5ae0c90b4134975a4e0b0
parent 08565ab3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -34,7 +34,9 @@ tBTM_CB btm_cb;

extern void btm_acl_init(void);
extern void btm_dev_init(void);
extern void btm_dev_free(void);
extern void btm_inq_db_init(void);
extern void btm_inq_db_free(void);
extern void btm_sco_init(void);
extern void wipe_secrets_and_remove(tBTM_SEC_DEV_REC* p_dev_rec);

@@ -89,6 +91,8 @@ void btm_free(void) {
  fixed_queue_free(btm_cb.sec_pending_q, NULL);
  btm_cb.sec_pending_q = NULL;

  btm_dev_free();

  list_node_t* end = list_end(btm_cb.sec_dev_rec);
  list_node_t* node = list_begin(btm_cb.sec_dev_rec);
  while (node != end) {
@@ -99,6 +103,7 @@ void btm_free(void) {
    wipe_secrets_and_remove(p_dev_rec);
  }

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