History

add dec memory check

huili2 committed 11 years ago

Commit 3cb417f1 parent 9ecc67112 files · +196 −141Browse files

Showing the changes to test/decoder/DecUT_ParseSyntax.cpp (1 of 12 files). Show all

Unified · Split

test/decoder/DecUT_ParseSyntax.cpp+10−0
@@ -65,6 +65,11 @@ int32_t InitDecoder (const bool bParseOnly, PWelsDecoderContext pCtx, SLogContex · 64 unmodified lines
65 if (NULL == pCtx)65 if (NULL == pCtx)
66 return cmMallocMemeError;66 return cmMallocMemeError;
67 67
68 if (NULL == pCtx->pMemAlign) {
69 pCtx->pMemAlign = new CMemoryAlign (16);
70 if (NULL == pCtx->pMemAlign)
71 return cmMallocMemeError;
72 }
68 73
69 return WelsInitDecoder (pCtx, bParseOnly, pLogCtx);74 return WelsInitDecoder (pCtx, bParseOnly, pLogCtx);
70}75}
@@ -92,6 +97,10 @@ void UninitDecoder (PWelsDecoderContext pCtx) { · 21 unmodified lines
92 return;97 return;
93 98
94 WelsEndDecoder (pCtx);99 WelsEndDecoder (pCtx);
100 if (NULL != pCtx->pMemAlign) {
101 delete pCtx->pMemAlign;
102 pCtx->pMemAlign = NULL;
103 }
95 if (NULL != pCtx) {104 if (NULL != pCtx) {
96 free (pCtx);105 free (pCtx);
97 pCtx = NULL;106 pCtx = NULL;
@@ -160,6 +169,7 @@ void DecoderParseSyntaxTest::Init() { · 62 unmodified lines
160 //169 //
161 m_pCtx = (PWelsDecoderContext)malloc (sizeof (SWelsDecoderContext));170 m_pCtx = (PWelsDecoderContext)malloc (sizeof (SWelsDecoderContext));
162 171
172 memset (m_pCtx, 0, sizeof (SWelsDecoderContext));
163 m_pWelsTrace = new welsCodecTrace();173 m_pWelsTrace = new welsCodecTrace();
164 if (m_pWelsTrace != NULL) {174 if (m_pWelsTrace != NULL) {
165 m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);175 m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);

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