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
6565 if (NULL == pCtx)
6666 return cmMallocMemeError;
6767
68+ if (NULL == pCtx->pMemAlign) {
69+ pCtx->pMemAlign = new CMemoryAlign (16);
70+ if (NULL == pCtx->pMemAlign)
71+ return cmMallocMemeError;
72+ }
6873
6974 return WelsInitDecoder (pCtx, bParseOnly, pLogCtx);
7075 }
@@ -92,6 +97,10 @@ void UninitDecoder (PWelsDecoderContext pCtx) { · 21 unmodified lines
9297 return;
9398
9499 WelsEndDecoder (pCtx);
100+ if (NULL != pCtx->pMemAlign) {
101+ delete pCtx->pMemAlign;
102+ pCtx->pMemAlign = NULL;
103+ }
95104 if (NULL != pCtx) {
96105 free (pCtx);
97106 pCtx = NULL;
@@ -160,6 +169,7 @@ void DecoderParseSyntaxTest::Init() { · 62 unmodified lines
160169 //
161170 m_pCtx = (PWelsDecoderContext)malloc (sizeof (SWelsDecoderContext));
162171
172+ memset (m_pCtx, 0, sizeof (SWelsDecoderContext));
163173 m_pWelsTrace = new welsCodecTrace();
164174 if (m_pWelsTrace != NULL) {
165175 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