Skip to content

Commit

Permalink
Make sure we don't double-close exchanges in OTA if an exchange times…
Browse files Browse the repository at this point in the history
… out. (#24818)

Fixes #24329
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Sep 6, 2023
1 parent 9872e27 commit 1147908
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/clusters/ota-requestor/DefaultOTARequestor.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ class DefaultOTARequestor : public OTARequestorInterface, public BDXDownloader::
void OnResponseTimeout(chip::Messaging::ExchangeContext * ec) override
{
ChipLogError(BDX, "exchange timed out");
// Null out mExchangeCtx before calling OnDownloadTimeout, in case
// the downloader decides to call Reset() on us. If we don't, we
// will end up closing the exchange from Reset and then the caller
// will close it _again_ (see API documentation for
// OnResponseTimeout), which will lead to refcount underflow.
mExchangeCtx = nullptr;
if (mDownloader != nullptr)
{
mDownloader->OnDownloadTimeout();
Expand Down

0 comments on commit 1147908

Please sign in to comment.