History

move the assigning m_uiSpatialPicNum earlier to cover the memory leak if error in allocating pic

sijchen committed 10 years ago

Commit 025500d1 parent 36722c51 file · +1 −1Browse files

Showing the changes to codec/encoder/core/src/wels_preprocess.cpp (1 of 1 file). Show all

Unified · Split

codec/encoder/core/src/wels_preprocess.cpp+1−1
@@ -135,6 +135,7 @@ int32_t CWelsPreProcess::AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCoding · 134 unmodified lines
135 const uint8_t kuiRefNumInTemporal = kuiLayerInTemporal + pParam->iLTRRefNum;135 const uint8_t kuiRefNumInTemporal = kuiLayerInTemporal + pParam->iLTRRefNum;
136 uint8_t i = 0;136 uint8_t i = 0;
137 137
138 m_uiSpatialPicNum[iDlayerIndex] = kuiRefNumInTemporal;
138 do {139 do {
139 SPicture* pPic = AllocPicture (pMa, kiPicWidth, kiPicHeight, false, 0);140 SPicture* pPic = AllocPicture (pMa, kiPicWidth, kiPicHeight, false, 0);
140 WELS_VERIFY_RETURN_IF (1, (NULL == pPic))141 WELS_VERIFY_RETURN_IF (1, (NULL == pPic))
@@ -147,7 +148,6 @@ int32_t CWelsPreProcess::AllocSpatialPictures (sWelsEncCtx* pCtx, SWelsSvcCoding · 6 unmodified lines
147 else148 else
148 m_uiSpatialLayersInTemporal[iDlayerIndex] = kuiLayerInTemporal;149 m_uiSpatialLayersInTemporal[iDlayerIndex] = kuiLayerInTemporal;
149 150
150 m_uiSpatialPicNum[iDlayerIndex] = kuiRefNumInTemporal;
151 ++ iDlayerIndex;151 ++ iDlayerIndex;
152 } while (iDlayerIndex < kiDlayerCount);152 } while (iDlayerIndex < kiDlayerCount);
153 153

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t