diff --git a/src/controller/AutoCommissioner.cpp b/src/controller/AutoCommissioner.cpp index d20aca3342956b..bf9d3eb76264d9 100644 --- a/src/controller/AutoCommissioner.cpp +++ b/src/controller/AutoCommissioner.cpp @@ -241,7 +241,7 @@ CHIP_ERROR AutoCommissioner::SetCommissioningParameters(const CommissioningParam // We can't reallocate mExtraReadPaths yet as this would free the old buffer, // and the caller might be passing a sub-span of the old paths. decltype(mExtraReadPaths) oldReadPaths(std::move(mExtraReadPaths)); - mExtraReadPaths.Alloc(extraReadPaths.size()); + VerifyOrReturnError(mExtraReadPaths.Alloc(extraReadPaths.size()).Get() != nullptr, CHIP_ERROR_NO_MEMORY); memcpy(mExtraReadPaths.Get(), extraReadPaths.data(), extraReadPaths.size() * sizeof(ReadPath)); }