From 642536ba3b3471f5879c628c37af28a312762efc Mon Sep 17 00:00:00 2001 From: Kaku Kuo Date: Thu, 16 Mar 2017 12:09:23 +0800 Subject: [PATCH] Bug 1345179 - use MakeUniqueFallible() in BlankVideoDataCreator; r=jwwang If OOM happends, just return null and the DummyMediaDataDecoder will reject the DecodePromise with NS_ERROR_OUT_OF_MEMORY. MozReview-Commit-ID: H6sTyoQWZk5 --HG-- extra : rebase_source : 5046a68978b817db8f1191e1f56e80ec5848899c --- dom/media/platforms/agnostic/BlankDecoderModule.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dom/media/platforms/agnostic/BlankDecoderModule.cpp b/dom/media/platforms/agnostic/BlankDecoderModule.cpp index 9d10cd6bb322..56cc231542c3 100644 --- a/dom/media/platforms/agnostic/BlankDecoderModule.cpp +++ b/dom/media/platforms/agnostic/BlankDecoderModule.cpp @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/CheckedInt.h" -#include "mozilla/UniquePtr.h" +#include "mozilla/UniquePtrExtensions.h" #include "mozilla/RefPtr.h" #include "nsRect.h" #include "nsSize.h" @@ -37,7 +37,10 @@ public: // with a U and V plane that are half the size of the Y plane, i.e 8 bit, // 2x2 subsampled. Have the data pointer of each frame point to the // first plane, they'll always be zero'd memory anyway. - auto frame = MakeUnique(mFrameWidth * mFrameHeight); + auto frame = MakeUniqueFallible(mFrameWidth * mFrameHeight); + if (!frame) { + return nullptr; + } memset(frame.get(), 0, mFrameWidth * mFrameHeight); VideoData::YCbCrBuffer buffer;