Skip to content

Commit 6848d04

Browse files
yunhanw-googlerestyled-commitsbzbarsky-apple
authored
[ICD] Shutdown icd client storage when destroying android controller (#36348)
* Shutdown DefautICDClientStorage when destorying Android controller * Restyled by whitespace * Update DefaultICDClientStorage.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 59d7388 commit 6848d04

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/app/icd/client/DefaultICDClientStorage.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -542,5 +542,14 @@ CHIP_ERROR DefaultICDClientStorage::ProcessCheckInPayload(const ByteSpan & paylo
542542
iterator->Release();
543543
return CHIP_ERROR_NOT_FOUND;
544544
}
545+
546+
void DefaultICDClientStorage::Shutdown()
547+
{
548+
mICDClientInfoIterators.ReleaseAll();
549+
mpClientInfoStore = nullptr;
550+
mpKeyStore = nullptr;
551+
mFabricList.clear();
552+
}
553+
545554
} // namespace app
546555
} // namespace chip

src/app/icd/client/DefaultICDClientStorage.h

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ class DefaultICDClientStorage : public ICDClientStorage
120120
CHIP_ERROR ProcessCheckInPayload(const ByteSpan & payload, ICDClientInfo & clientInfo,
121121
Protocols::SecureChannel::CounterType & counter) override;
122122

123+
/**
124+
* Shut down DefaultICDClientStorage
125+
*
126+
*/
127+
void Shutdown();
128+
123129
#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
124130
size_t GetFabricListSize() { return mFabricList.size(); }
125131

src/controller/java/AndroidDeviceControllerWrapper.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ using namespace TLV;
5050

5151
AndroidDeviceControllerWrapper::~AndroidDeviceControllerWrapper()
5252
{
53+
getICDClientStorage()->Shutdown();
5354
mController->Shutdown();
5455

5556
if (mKeypairBridge != nullptr)

0 commit comments

Comments
 (0)