shithub: openh264

Download patch

ref: c441f6f390badb14e1e4e1d66ca5d9033be1dc83
parent: a8d9576297ffdf10f5c76ff0cf3ef59f51936db1
parent: 693fd142723859fadd862da500bd6f5830861b42
author: HaiboZhu <haibozhu@cisco.com>
date: Thu Mar 17 11:46:12 EDT 2016

Merge pull request #2411 from huili2/memory_leak_fix

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);