History

add protection for decoder and data format

huili2 committed 12 years ago

Commit f8d2ae41 parent 06e56ec4 files · +36 −17Browse files

Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 4 files). Show all

Unified · Split

codec/decoder/plus/src/welsDecoderExt.cpp+11−5
@@ -185,6 +185,7 @@ CWelsDecoder::~CWelsDecoder() { · 184 unmodified lines
185185 }
186186
187187 long CWelsDecoder::Initialize (const SDecodingParam* pParam) {
188+ int iRet = ERR_NONE;
188189 if (m_pWelsTrace == NULL) {
189190 return cmMallocMemeError;
190191 }
@@ -195,9 +196,13 @@ long CWelsDecoder::Initialize (const SDecodingParam* pParam) { · 4 unmodified lines
195196 }
196197
197198 // H.264 decoder initialization,including memory allocation,then open it ready to decode
198− InitDecoder();
199+ iRet = InitDecoder();
200+ if (iRet)
201+ return iRet;
199202
200− DecoderConfigParam (m_pDecContext, pParam);
203+ iRet = DecoderConfigParam (m_pDecContext, pParam);
204+ if (iRet)
205+ return iRet;
201206
202207 return cmResultSuccess;
203208 }
@@ -226,15 +231,16 @@ void CWelsDecoder::UninitDecoder (void) { · 22 unmodified lines
226231 }
227232
228233 // the return value of this function is not suitable, it need report failure info to upper layer.
229−void CWelsDecoder::InitDecoder (void) {
234+int32_t CWelsDecoder::InitDecoder (void) {
230235
231236 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::init_decoder(), openh264 codec version = %s",
232237 VERSION_NUMBER);
233238
234239 m_pDecContext = (PWelsDecoderContext)WelsMalloc (sizeof (SWelsDecoderContext), "m_pDecContext");
240+ if (NULL == m_pDecContext)
241+ return cmMallocMemeError;
235242
236− WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx);
237−
243+ return WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx);
238244 }
239245
240246 /*

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