From 273c80ecd38f6eb8ca4bda9f256ecf4ef87176e6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 9 Aug 2026 19:59:06 -0500 Subject: [PATCH] Address review: state the table lifetime where it is freed Every teardown path routes through release_services(), so the materialized table cannot outlive its link - said at free_service_table_ so the next reviewer need not re-derive it. --- .../bluetooth_connection/bluetooth_connection_bluedroid.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esphome/components/bluetooth_connection/bluetooth_connection_bluedroid.cpp b/esphome/components/bluetooth_connection/bluetooth_connection_bluedroid.cpp index f83cc6ac5f..0054bb4894 100644 --- a/esphome/components/bluetooth_connection/bluetooth_connection_bluedroid.cpp +++ b/esphome/components/bluetooth_connection/bluetooth_connection_bluedroid.cpp @@ -346,6 +346,9 @@ ble_device_base::GattServiceTable BluedroidGattClient::table_view_() const { this->table_desc_total_}; } +// Lifetime: every teardown path (CLOSE_EVT, the safety timeout, stack-down, +// passive DISCONNECT) routes through release_services(), so a materialized +// table cannot outlive its link. void BluedroidGattClient::free_service_table_() { if (this->table_storage_ == nullptr) { return;