From ca9ecef5733f6ba0bb82cfdc95f90a4234cbcf0b Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Tue, 4 Jan 2022 09:06:25 -0600 Subject: [PATCH] Add check for failed allocation in ResolverProxy::Init (#13290) Fixes #12943 --- src/lib/dnssd/ResolverProxy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/dnssd/ResolverProxy.h b/src/lib/dnssd/ResolverProxy.h index e7ce4fa10c408f..43c7184218559e 100644 --- a/src/lib/dnssd/ResolverProxy.h +++ b/src/lib/dnssd/ResolverProxy.h @@ -68,7 +68,7 @@ class ResolverProxy : public Resolver ReturnErrorOnFailure(chip::Dnssd::Resolver::Instance().Init(udpEndPoint)); VerifyOrReturnError(mDelegate == nullptr, CHIP_ERROR_INCORRECT_STATE); mDelegate = chip::Platform::New(); - return CHIP_NO_ERROR; + return mDelegate != nullptr ? CHIP_NO_ERROR : CHIP_ERROR_NO_MEMORY; } void SetResolverDelegate(ResolverDelegate * delegate) override