Skip to content

Commit

Permalink
[ICD] Shutdown icd client storage when destroying android controller (#…
Browse files Browse the repository at this point in the history
…36348)

* Shutdown DefautICDClientStorage when destorying Android controller

* Restyled by whitespace

* Update DefaultICDClientStorage.h

Co-authored-by: Boris Zbarsky <[email protected]>

---------

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent 59d7388 commit 6848d04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/icd/client/DefaultICDClientStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,5 +542,14 @@ CHIP_ERROR DefaultICDClientStorage::ProcessCheckInPayload(const ByteSpan & paylo
iterator->Release();
return CHIP_ERROR_NOT_FOUND;
}

void DefaultICDClientStorage::Shutdown()
{
mICDClientInfoIterators.ReleaseAll();
mpClientInfoStore = nullptr;
mpKeyStore = nullptr;
mFabricList.clear();
}

} // namespace app
} // namespace chip
6 changes: 6 additions & 0 deletions src/app/icd/client/DefaultICDClientStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ class DefaultICDClientStorage : public ICDClientStorage
CHIP_ERROR ProcessCheckInPayload(const ByteSpan & payload, ICDClientInfo & clientInfo,
Protocols::SecureChannel::CounterType & counter) override;

/**
* Shut down DefaultICDClientStorage
*
*/
void Shutdown();

#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
size_t GetFabricListSize() { return mFabricList.size(); }

Expand Down
1 change: 1 addition & 0 deletions src/controller/java/AndroidDeviceControllerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ using namespace TLV;

AndroidDeviceControllerWrapper::~AndroidDeviceControllerWrapper()
{
getICDClientStorage()->Shutdown();
mController->Shutdown();

if (mKeypairBridge != nullptr)
Expand Down

0 comments on commit 6848d04

Please sign in to comment.