shithub: openh264

Download patch

ref: 693fd142723859fadd862da500bd6f5830861b42
parent: a8d9576297ffdf10f5c76ff0cf3ef59f51936db1
author: unknown <huili2@HUILI2-FVDLJ.cisco.com>
date: Thu Mar 17 06:31:25 EDT 2016

fix memory leak when alloc failed in decoder

--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -1247,6 +1247,7 @@
     if (pDq == NULL)
       return ERR_INFO_OUT_OF_MEMORY;
 
+    pCtx->pDqLayersList[i] = pDq; //to keep consistence with in UninitialDqLayersContext()
     memset (pDq, 0, sizeof (SDqLayer));
 
     pCtx->sMb.pMbType[i] = (int16_t*)pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int16_t),
@@ -1337,7 +1338,6 @@
 
     memset (pCtx->sMb.pSliceIdc[i], 0xff, (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int32_t)));
 
-    pCtx->pDqLayersList[i] = pDq;
     ++ i;
   } while (i < LAYER_NUM_EXCHANGEABLE);