]> granicus.if.org Git - esp-idf/commitdiff
component/bt: Fix mem leak of bt
authorbaohongde <baohongde@espressif.com>
Wed, 7 Feb 2018 09:03:48 +0000 (17:03 +0800)
committerbaohongde <baohongde@espressif.com>
Thu, 8 Feb 2018 08:26:12 +0000 (16:26 +0800)
components/bt/bluedroid/bta/av/bta_av_act.c
components/bt/bluedroid/btc/profile/std/a2dp/btc_a2dp_sink.c
components/bt/bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c
examples/bluetooth/a2dp_sink/main/bt_app_core.c
examples/bluetooth/a2dp_source/main/bt_app_core.c

index 9b00d62cea4e6afed884b4218002b4b761f1f3cf..b86875870c7e9109789181f7393d343c821faaf1 100644 (file)
@@ -1847,6 +1847,8 @@ void bta_av_dereg_comp(tBTA_AV_DATA *p_data)
 
         /* make sure that the timer is not active */
         bta_sys_stop_timer(&p_scb->timer);
+        list_free(p_scb->a2d_list);
+        p_scb->a2d_list = NULL;
         utl_freebuf((void **)&p_cb->p_scb[p_scb->hdi]);
     }
 
index 671584448459e5497edd790fa4f061b362a15cdb..d52391a8684bd88d94fa839e889184da2daaa9c1 100644 (file)
@@ -273,7 +273,10 @@ error_exit:;
         vQueueDelete(btc_aa_snk_ctrl_queue);
         btc_aa_snk_ctrl_queue = NULL;
     }
-
+    if (btc_aa_snk_queue_set) {
+        vQueueDelete(btc_aa_snk_queue_set);
+        btc_aa_snk_queue_set = NULL;
+    }
     return false;
 }
 
@@ -292,6 +295,9 @@ void btc_a2dp_sink_shutdown(void)
 
     vQueueDelete(btc_aa_snk_ctrl_queue);
     btc_aa_snk_ctrl_queue = NULL;
+
+    vQueueDelete(btc_aa_snk_queue_set);
+    btc_aa_snk_queue_set = NULL;
 }
 
 /*****************************************************************************
index d405917832cd0e378e6d8468862ac0df5c8e77ea..cbcce62200e22145b450252a484c978b49f76992 100644 (file)
@@ -348,7 +348,10 @@ error_exit:;
         vQueueDelete(btc_aa_src_ctrl_queue);
         btc_aa_src_ctrl_queue = NULL;
     }
-
+    if (btc_aa_src_queue_set) {
+        vQueueDelete(btc_aa_src_queue_set);
+        btc_aa_src_queue_set = NULL;
+    }
     return false;
 }
 
@@ -367,6 +370,9 @@ void btc_a2dp_source_shutdown(void)
 
     vQueueDelete(btc_aa_src_ctrl_queue);
     btc_aa_src_ctrl_queue = NULL;
+
+    vQueueDelete(btc_aa_src_queue_set);
+    btc_aa_src_queue_set = NULL;
 }
 
 /*****************************************************************************
index 6c48d9a7034d4cde2fcc20b840dc2ff613191e74..b04d5c89abbda8ac0f1b720a76e285a41383a702 100644 (file)
@@ -27,7 +27,7 @@ static xTaskHandle bt_app_task_handle = NULL;
 bool bt_app_work_dispatch(bt_app_cb_t p_cback, uint16_t event, void *p_params, int param_len, bt_app_copy_cb_t p_copy_cback)
 {
     ESP_LOGD(BT_APP_CORE_TAG, "%s event 0x%x, param len %d", __func__, event, param_len);
-    
+
     bt_app_msg_t msg;
     memset(&msg, 0, sizeof(bt_app_msg_t));
 
@@ -96,7 +96,7 @@ static void bt_app_task_handler(void *arg)
 void bt_app_task_start_up(void)
 {
     bt_app_task_queue = xQueueCreate(10, sizeof(bt_app_msg_t));
-    xTaskCreate(bt_app_task_handler, "BtAppT", 2048, NULL, configMAX_PRIORITIES - 3, bt_app_task_handle);
+    xTaskCreate(bt_app_task_handler, "BtAppT", 2048, NULL, configMAX_PRIORITIES - 3, &bt_app_task_handle);
     return;
 }
 
index be699ef8ace7547303b7afaade80c5e4576a53c1..b04d5c89abbda8ac0f1b720a76e285a41383a702 100644 (file)
@@ -96,7 +96,7 @@ static void bt_app_task_handler(void *arg)
 void bt_app_task_start_up(void)
 {
     bt_app_task_queue = xQueueCreate(10, sizeof(bt_app_msg_t));
-    xTaskCreate(bt_app_task_handler, "BtAppT", 2048, NULL, configMAX_PRIORITIES - 3, bt_app_task_handle);
+    xTaskCreate(bt_app_task_handler, "BtAppT", 2048, NULL, configMAX_PRIORITIES - 3, &bt_app_task_handle);
     return;
 }