From 3297a174d6f599962616d2ac972d6641e58a1008 Mon Sep 17 00:00:00 2001 From: Zhanglong Xia Date: Thu, 24 Aug 2023 15:38:05 +0800 Subject: [PATCH] remove manually freeing the variable mDeathRecipient The variable `mDeathRecipient` will automatically free the allocated memory when it is destructed. This CL deletes the code for manually releasing the variable `mDeathRecipient` to avoid the same variable being freed twice. Bug: 296617022 Test: Run fuzzer test. Change-Id: I733f7f8d26e48a9434d41c5098f39ad91208abeb --- threadnetwork/aidl/default/thread_chip.cpp | 4 ---- threadnetwork/aidl/default/thread_chip.hpp | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/threadnetwork/aidl/default/thread_chip.cpp b/threadnetwork/aidl/default/thread_chip.cpp index 3d38cb841b..9358ebae2c 100644 --- a/threadnetwork/aidl/default/thread_chip.cpp +++ b/threadnetwork/aidl/default/thread_chip.cpp @@ -59,10 +59,6 @@ ThreadChip::ThreadChip(char* url) : mUrl(), mRxFrameBuffer(), mCallback(nullptr) AIBinder_DeathRecipient_setOnUnlinked(mDeathRecipient.get(), ThreadChip::onBinderUnlinkedJump); } -ThreadChip::~ThreadChip() { - AIBinder_DeathRecipient_delete(mDeathRecipient.get()); -} - void ThreadChip::onBinderDiedJump(void* context) { reinterpret_cast(context)->onBinderDied(); } diff --git a/threadnetwork/aidl/default/thread_chip.hpp b/threadnetwork/aidl/default/thread_chip.hpp index 1ab6d544d1..680580a29d 100644 --- a/threadnetwork/aidl/default/thread_chip.hpp +++ b/threadnetwork/aidl/default/thread_chip.hpp @@ -34,7 +34,7 @@ namespace threadnetwork { class ThreadChip : public BnThreadChip, ot::Posix::Mainloop::Source { public: ThreadChip(char* url); - ~ThreadChip(); + ~ThreadChip() {} ndk::ScopedAStatus open(const std::shared_ptr& in_callback) override; ndk::ScopedAStatus close() override;