ref: 025500d5aa59de75ff7ed5be94a4c635aa0cd1a5
parent: 36722c553b4b773ab9cda20caa6691be927bc510
author: sijchen <sijchen@cisco.com>
date: Fri Feb 12 11:20:08 EST 2016
move the assigning m_uiSpatialPicNum earlier to cover the memory leak if error in allocating pic
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -135,6 +135,7 @@
const uint8_t kuiRefNumInTemporal = kuiLayerInTemporal + pParam->iLTRRefNum;
uint8_t i = 0;
+ m_uiSpatialPicNum[iDlayerIndex] = kuiRefNumInTemporal;
do {
SPicture* pPic = AllocPicture (pMa, kiPicWidth, kiPicHeight, false, 0);
WELS_VERIFY_RETURN_IF (1, (NULL == pPic))
@@ -147,7 +148,6 @@
else
m_uiSpatialLayersInTemporal[iDlayerIndex] = kuiLayerInTemporal;
- m_uiSpatialPicNum[iDlayerIndex] = kuiRefNumInTemporal;
++ iDlayerIndex;
} while (iDlayerIndex < kiDlayerCount);