From 693fd142723859fadd862da500bd6f5830861b42 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Mar 2016 10:31:25 +0800 Subject: [PATCH] fix memory leak when alloc failed in decoder --- codec/decoder/core/src/decoder_core.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp index 46ad95a5..90daeb7d 100644 --- a/codec/decoder/core/src/decoder_core.cpp +++ b/codec/decoder/core/src/decoder_core.cpp @@ -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);