• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

Revisiónd92387bc0ad8eb08374e1ad4d30f243d75774dc1 (tree)
Tiempo2019-11-08 09:19:43
AutorNick Desaulniers <ndesaulniers@goog...>
CommiterKyriakos Ispoglou

Log Message

[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
Bug: 142558228
Test: mm
Change-Id: I30972458abcc563b24ee0d80b289c3efd6c3e04d
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
(cherry picked from commit 20ed45d6339079645ef9fe576b894e9497684c93)

Cambiar Resumen

Diferencia incremental

--- a/service/low_energy_client.cc
+++ b/service/low_energy_client.cc
@@ -188,8 +188,8 @@ void LowEnergyClient::MtuChangedCallback(
188188
189189 if (!bda) return;
190190
191- const char* addr = BtAddrString(bda).c_str();
192- if (delegate_) delegate_->OnMtuChanged(this, status, addr, mtu);
191+ std::string addr = BtAddrString(bda);
192+ if (delegate_) delegate_->OnMtuChanged(this, status, addr.c_str(), mtu);
193193 }
194194
195195 // LowEnergyClientFactory implementation