diff options
author | Sven Gothel <[email protected]> | 2022-04-15 18:01:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-04-15 18:01:28 +0200 |
commit | 7cf37805d1e1e08608104465a800a6ecac2f4815 (patch) | |
tree | a848fdd2ba12a540a3e3d337c661872137033368 | |
parent | 85c5376ff3385bb6695b7bd05405603d1523269b (diff) |
Fix uninitialized fields (valgrind conditional jump) in BTAdapter, BTDevice and HCIHandler, shown w/ DBG_PRINT()
dbt_scanner10 is now clean of valgrind w/ tool=memcheck
-rw-r--r-- | src/direct_bt/BTAdapter.cpp | 1 | ||||
-rw-r--r-- | src/direct_bt/BTDevice.cpp | 3 | ||||
-rw-r--r-- | src/direct_bt/HCIHandler.cpp | 4 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/direct_bt/BTAdapter.cpp b/src/direct_bt/BTAdapter.cpp index bed5a490..bbbabd65 100644 --- a/src/direct_bt/BTAdapter.cpp +++ b/src/direct_bt/BTAdapter.cpp @@ -381,6 +381,7 @@ BTAdapter::BTAdapter(const BTAdapter::ctor_cookie& cc, BTManager& mgmt_, const A adapterInfo( adapterInfo_ ), adapter_initialized( false ), adapter_poweredon_at_init( false ), le_features( LE_Features::NONE ), + hci_uses_ext_scan( false ), hci_uses_ext_conn( false ), hci_uses_ext_adv( false ), visibleAddressAndType( adapterInfo_.addressAndType ), dev_id( adapterInfo.dev_id ), btRole ( BTRole::Master ), diff --git a/src/direct_bt/BTDevice.cpp b/src/direct_bt/BTDevice.cpp index 0737e068..25765b43 100644 --- a/src/direct_bt/BTDevice.cpp +++ b/src/direct_bt/BTDevice.cpp @@ -49,6 +49,7 @@ BTDevice::BTDevice(const ctor_cookie& cc, BTAdapter & a, EInfoReport const & r) l2cap_att( std::make_unique<L2CAPClient>(adapter.dev_id, adapter.getAddressAndType(), L2CAP_PSM::UNDEFINED, L2CAP_CID::ATT) ), // copy elision, not copy-ctor ts_last_discovery(r.getTimestamp()), ts_last_update(ts_last_discovery), + name(), eir( std::make_shared<EInfoReport>() ), hciConnHandle(0), le_features(LE_Features::NONE), @@ -58,12 +59,14 @@ BTDevice::BTDevice(const ctor_cookie& cc, BTAdapter & a, EInfoReport const & r) allowDisconnect(false), supervision_timeout(0), smp_events(0), + pairing_data { }, ts_creation(ts_last_discovery), addressAndType{r.getAddress(), r.getAddressType()} { (void)cc; clearSMPStates(false /* connected */); + if( !r.isSet(EIRDataType::BDADDR) ) { throw jau::IllegalArgumentException("Address not set: "+r.toString(), E_FILE_LINE); } diff --git a/src/direct_bt/HCIHandler.cpp b/src/direct_bt/HCIHandler.cpp index 9660af9d..f1549b3f 100644 --- a/src/direct_bt/HCIHandler.cpp +++ b/src/direct_bt/HCIHandler.cpp @@ -673,11 +673,15 @@ HCIHandler::HCIHandler(const uint16_t dev_id_, const BTMode btMode_) noexcept jau::service_runner::Callback() /* init */, jau::bindMemberFunc(this, &HCIHandler::hciReaderEndLocked)), hciEventRing(env.HCI_EVT_RING_CAPACITY), + le_ll_feats( LE_Features::NONE ), + sup_commands_set( false ), allowClose( comm.isOpen() ), btMode(btMode_), currentScanType(ScanType::NONE), advertisingEnabled(false) { + zeroSupCommands(); + WORDY_PRINT("HCIHandler<%u>.ctor: Start %s", dev_id, toString().c_str()); if( !allowClose ) { ERR_PRINT("HCIHandler<%u>::ctor: Could not open hci control channel %s", dev_id, toString().c_str()); |