diff --git a/components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c b/components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c index 6446a4f026..249bafa56c 100644 --- a/components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c +++ b/components/bt/host/bluedroid/btc/profile/esp/blufi/blufi_prf.c @@ -151,6 +151,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) if (blufi_env.prepare_buf == NULL) { blufi_env.prepare_buf = osi_malloc(BLUFI_PREPAIR_BUF_MAX_SIZE); + blufi_env.prepare_len = 0; if (blufi_env.prepare_buf == NULL) { BLUFI_TRACE_ERROR("Blufi prep no mem\n"); status = GATT_NO_RESOURCES; @@ -178,6 +179,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) if (blufi_env.prepare_buf) { osi_free(blufi_env.prepare_buf); blufi_env.prepare_buf = NULL; + blufi_env.prepare_len = 0; } BLUFI_TRACE_ERROR("write data error , error code 0x%x\n", status); return; @@ -213,6 +215,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) if (blufi_env.prepare_buf) { osi_free(blufi_env.prepare_buf); blufi_env.prepare_buf = NULL; + blufi_env.prepare_len = 0; } break;