diff --git a/src/controller/python/chip/bdx/bdx-transfer-manager.cpp b/src/controller/python/chip/bdx/bdx-transfer-manager.cpp index c1dd8182a92be8..3742fefbcd165b 100644 --- a/src/controller/python/chip/bdx/bdx-transfer-manager.cpp +++ b/src/controller/python/chip/bdx/bdx-transfer-manager.cpp @@ -52,7 +52,11 @@ BdxTransfer * BdxTransferManager::Allocate() VerifyOrReturnValue(mExpectedTransfers != 0, nullptr); BdxTransfer * result = mTransferPool.CreateObject(mSystemLayer); - VerifyOrReturnValue(result != nullptr, nullptr); + if (result == nullptr) { + ChipLogError(BDX, "Failed to allocate BDX transfer. The pool (size %d) is exhausted.", + static_cast(kTransferPoolSize)); + return nullptr; + } result->SetDelegate(mBdxTransferDelegate); --mExpectedTransfers; diff --git a/src/controller/python/chip/bdx/bdx-transfer-manager.h b/src/controller/python/chip/bdx/bdx-transfer-manager.h index 07610083672894..8fda6c33b88571 100644 --- a/src/controller/python/chip/bdx/bdx-transfer-manager.h +++ b/src/controller/python/chip/bdx/bdx-transfer-manager.h @@ -51,7 +51,11 @@ class BdxTransferManager : public BdxTransferPool void Release(BdxTransfer * bdxTransfer) override; private: - ObjectPool mTransferPool; + // The maximum number of transfers to support at once. This number was chosen because it should be sufficient for + // current tests that use BDX. + static constexpr size_t kTransferPoolSize = 2; + + ObjectPool mTransferPool; System::Layer * mSystemLayer = nullptr; BdxTransfer::Delegate * mBdxTransferDelegate = nullptr; size_t mExpectedTransfers = 0;