From 5d02fafd5c6ae0649d45816ffee374c76bf53038 Mon Sep 17 00:00:00 2001 From: Karsten Sperling Date: Mon, 23 Dec 2024 13:56:33 +1300 Subject: [PATCH] Check for alloc failure --- src/controller/AutoCommissioner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); }