component/bt: Fix mem leak of bt in v3.0
authorbaohongde <baohongde@espressif.com>
Thu, 8 Feb 2018 03:18:30 +0000 (11:18 +0800)
committerbot <bot@espressif.com>
Fri, 2 Mar 2018 03:53:07 +0000 (03:53 +0000)
components/bt/bluedroid/bta/av/bta_av_act.c
components/bt/bluedroid/btc/profile/std/a2dp/btc_media_task.c
examples/bluetooth/a2dp_sink/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 94e77cd717c50aa56f512f588f23e1715dd654ec..89f00d29dee2a5784f091c5a05ce154c025c62aa 100644 (file)
@@ -319,6 +319,11 @@ error_exit:;
         xBtcMediaCtrlQueue = NULL;
     }
 
+    if (xBtcMediaQueueSet) {
+        vQueueDelete(xBtcMediaQueueSet);
+        xBtcMediaQueueSet = NULL;
+    }
+
     fixed_queue_free(btc_media_cmd_msg_queue, NULL);
     btc_media_cmd_msg_queue = NULL;
     return false;
@@ -340,6 +345,9 @@ void btc_a2dp_stop_media_task(void)
     vQueueDelete(xBtcMediaCtrlQueue);
     xBtcMediaCtrlQueue = NULL;
 
+    vQueueDelete(xBtcMediaQueueSet);
+    xBtcMediaQueueSet = NULL;
+
     fixed_queue_free(btc_media_cmd_msg_queue, NULL);
     btc_media_cmd_msg_queue = NULL;
 }
index 533dfda2f2dede43da2f7a18cf3ce074e7ea8f19..e84d51720df4ca3d029a1169d1b32ad8a07416c6 100644 (file)
@@ -33,7 +33,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));
 
@@ -102,7 +102,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;
 }