[system][bt] fix -Wdangling-gsl
BtAddrString() returns a std::string. It's not safe to chain a call to
c_str() as otherwise the returned std::string is a temporary, and the
expression evaluates to an immediately dangling pointer.
Bug: 139945549
Test: mm
Change-Id: I30972458abcc563b24ee0d80b289c3efd6c3e04d
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
diff --git a/service/low_energy_client.cc b/service/low_energy_client.cc
index cc127c3..cb8bcf1 100644
--- a/service/low_energy_client.cc
+++ b/service/low_energy_client.cc
@@ -188,8 +188,8 @@
if (!bda) return;
- const char* addr = BtAddrString(bda).c_str();
- if (delegate_) delegate_->OnMtuChanged(this, status, addr, mtu);
+ std::string addr = BtAddrString(bda);
+ if (delegate_) delegate_->OnMtuChanged(this, status, addr.c_str(), mtu);
}
// LowEnergyClientFactory implementation