From 63c7984d20ca16070bb8a210df652b5ac4e68215 Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 7 Apr 2023 19:37:36 +0800 Subject: [PATCH] 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 f612c83a..8c7bffc9 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