Merge pull request #2411 from huili2/memory_leak_fix

fix memory leak when alloc failed in decoder
This commit is contained in:
HaiboZhu 2016-03-17 15:46:12 +08:00
commit c441f6f390

View File

@ -1247,6 +1247,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
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 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
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);