OSDN Git Service

Unregister BTU queues upon shutdown
authorZach Johnson <zachoverflow@google.com>
Sat, 27 Sep 2014 00:04:51 +0000 (17:04 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Mon, 16 Mar 2015 23:51:34 +0000 (16:51 -0700)
This ensures that the next run doesn't try to access memory
that is no longer valid.

stack/btu/btu_init.c
stack/btu/btu_task.c

index 423cc88..7b24ff4 100644 (file)
@@ -216,8 +216,7 @@ void BTU_ShutDown(void) {
       GKI_freebuf(GKI_dequeue(&btu_cb.hci_cmd_cb[i].cmd_cmpl_q));
   }
 
-  fixed_queue_unregister_dequeue(btu_l2cap_alarm_queue);
-  fixed_queue_unregister_dequeue(btu_general_alarm_queue);
+  btu_task_shut_down(NULL);
 
   fixed_queue_free(btu_bta_msg_queue, NULL);
 
index 64b2b9b..d520039 100644 (file)
@@ -459,9 +459,13 @@ void btu_task_start_up(UNUSED_ATTR void *context) {
 }
 
 void btu_task_shut_down(UNUSED_ATTR void *context) {
-#if (defined(BTU_BTA_INCLUDED) && BTU_BTA_INCLUDED == TRUE)
+  fixed_queue_unregister_dequeue(btu_bta_msg_queue);
+  fixed_queue_unregister_dequeue(btu_hci_msg_queue);
+  fixed_queue_unregister_dequeue(btu_general_alarm_queue);
+  fixed_queue_unregister_dequeue(btu_oneshot_alarm_queue);
+  fixed_queue_unregister_dequeue(btu_l2cap_alarm_queue);
+
   bta_sys_free();
-#endif
   btu_free_core();
 }