shithub: openh264

Download patch

ref: 94b55520b8fd861b80e0e36ac82a553361fffdcf
parent: 1b11d831ad145a2a5aad9cf7f4182d83e81d4d42
author: Karina <ruil2@cisco.com>
date: Mon Jan 9 08:42:00 EST 2017

use the correct return value when memory can't be allocated.

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3627,6 +3627,11 @@
   }
   // perform csc/denoise/downsample/padding, generate spatial layers
   iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic);
+  if (iSpatialNum == -1) {
+    WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "Failed in allocating memory in BuildSpatialPicList");
+    return ENC_RETURN_MEMALLOCERR;
+  }
+
   if (pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus) {
     pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum, pFbi->uiTimeStamp);
   }