From 092e08c97b1e0541c6984854f7221ce777adae5e Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 7 Apr 2023 19:37:36 +0800 Subject: [PATCH] fixed 63c7984 from https://gitee.com/lilong32/communication_bluetooth/pulls/732 modify crash issue Signed-off-by: lee --- .../bluetooth/server/src/bluetooth_gatt_server_server.cpp | 4 +++- services/bluetooth/stack/src/btm/btm.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/services/bluetooth/server/src/bluetooth_gatt_server_server.cpp b/services/bluetooth/server/src/bluetooth_gatt_server_server.cpp index 6c968159..5b1e4a3e 100644 --- a/services/bluetooth/server/src/bluetooth_gatt_server_server.cpp +++ b/services/bluetooth/server/src/bluetooth_gatt_server_server.cpp @@ -226,7 +226,9 @@ BluetoothGattServerServer::impl::GattServerCallbackImpl::GattServerCallbackImpl( const sptr &callback, BluetoothGattServerServer &owner) : callback_(callback), deathRecipient_(new GattServerCallbackDeathRecipient(callback, owner)) { - if (!callback_->AsObject()->AddDeathRecipient(deathRecipient_)) { + if (callback_ != nullptr && + callback_->AsObject() != nullptr && + !callback_->AsObject()->AddDeathRecipient(deathRecipient_)) { HILOGE("Failed to link death recipient to callback"); } tokenId_ = IPCSkeleton::GetCallingTokenID(); diff --git a/services/bluetooth/stack/src/btm/btm.c b/services/bluetooth/stack/src/btm/btm.c index d322c126..1ea7111d 100644 --- a/services/bluetooth/stack/src/btm/btm.c +++ b/services/bluetooth/stack/src/btm/btm.c @@ -199,7 +199,7 @@ int BTM_Initialize() return result; } -int BTM_Close() +NO_SANITIZE("cfi") int BTM_Close() { LOG_DEBUG("%{public}s start", __FUNCTION__); -- Gitee