ble_mesh:the memory requested by malloc has not benn released

This commit is contained in:
Yuan Hong Hui
2022-07-20 15:06:38 +08:00
committed by BOT
parent d016f69ffc
commit 10f0879fdb

View File

@ -60,6 +60,7 @@ void ble_mesh_test_performance_client_model_throughput(void *params)
esp_ble_mesh_msg_ctx_t ctx; esp_ble_mesh_msg_ctx_t ctx;
transaction_t *trans = NULL; transaction_t *trans = NULL;
ble_mesh_test_perf_throughput_data *profile_context = (ble_mesh_test_perf_throughput_data *)params; ble_mesh_test_perf_throughput_data *profile_context = (ble_mesh_test_perf_throughput_data *)params;
esp_err_t result = ESP_OK;
ESP_LOGD(TAG, "enter %s\n", __func__); ESP_LOGD(TAG, "enter %s\n", __func__);
@ -74,6 +75,7 @@ void ble_mesh_test_performance_client_model_throughput(void *params)
data = malloc(profile_context->length); data = malloc(profile_context->length);
if (data == NULL) { if (data == NULL) {
ESP_LOGE(TAG, " %s, %d, malloc fail\n", __func__, __LINE__); ESP_LOGE(TAG, " %s, %d, malloc fail\n", __func__, __LINE__);
goto cleanup;
} }
for (i = 1; i <= profile_context->test_num; i++) { for (i = 1; i <= profile_context->test_num; i++) {
@ -82,16 +84,29 @@ void ble_mesh_test_performance_client_model_throughput(void *params)
TRANSACTION_INIT(&trans, TRANS_TYPE_MESH_PERF, TRANS_MESH_SEND_MESSAGE, TRANSACTION_INIT(&trans, TRANS_TYPE_MESH_PERF, TRANS_MESH_SEND_MESSAGE,
TRANS_MESH_SEND_MESSAGE_EVT, SEND_MESSAGE_TIMEOUT, &start_time, NULL); TRANS_MESH_SEND_MESSAGE_EVT, SEND_MESSAGE_TIMEOUT, &start_time, NULL);
//tx: data profile_context->length //tx: data profile_context->length
esp_ble_mesh_client_model_send_msg(profile_context->model, &ctx, profile_context->opcode, result = esp_ble_mesh_client_model_send_msg(profile_context->model, &ctx, profile_context->opcode,
profile_context->length, data, 8000, profile_context->need_ack, profile_context->device_role); profile_context->length, data, 8000,
profile_context->need_ack,
profile_context->device_role);
ble_mesh_test_performance_client_model_accumulate_statistics(profile_context->length); ble_mesh_test_performance_client_model_accumulate_statistics(profile_context->length);
transaction_run(trans); transaction_run(trans);
if (result == ESP_OK) {
ESP_LOGI(TAG, "VendorModel:SendPackage,OK");
} else {
ESP_LOGI(TAG, "VendorModel:SendPackage,Fail");
}
} }
ESP_LOGI(TAG, "VendorModel:SendPackage,Finish"); ESP_LOGI(TAG, "VendorModel:SendPackage,Finish");
cleanup:
free(params); free(params);
vTaskDelete(NULL); if (data != NULL) {
free(data);
}
ESP_LOGD(TAG, "exit %s\n", __func__); ESP_LOGD(TAG, "exit %s\n", __func__);
vTaskDelete(NULL);
} }
int ble_mesh_test_performance_client_model(int argc, char **argv) int ble_mesh_test_performance_client_model(int argc, char **argv)