Commit 68e7882a authored by Kiran Misra's avatar Kiran Misra

Fixes for (a) memory leaks and (b)conditional jump based on uninitialized...

Fixes for (a) memory leaks and (b)conditional jump based on uninitialized variable, reported by valgrind when decoding a bitstream
parent eb1390ec
......@@ -217,19 +217,25 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const
// Laplacian based activity
for( int i = 0; i < NUM_DIRECTIONS; i++ )
{
m_laplacian[i] = new int*[m_CLASSIFICATION_BLK_SIZE + 5];
for( int y = 0; y < m_CLASSIFICATION_BLK_SIZE + 5; y++ )
if ( m_laplacian[i] == nullptr )
{
m_laplacian[i][y] = new int[m_CLASSIFICATION_BLK_SIZE + 5];
m_laplacian[i] = new int*[m_CLASSIFICATION_BLK_SIZE + 5];
for( int y = 0; y < m_CLASSIFICATION_BLK_SIZE + 5; y++ )
{
m_laplacian[i][y] = new int[m_CLASSIFICATION_BLK_SIZE + 5];
}
}
}
// Classification
m_classifier = new AlfClassifier*[picHeight];
for( int i = 0; i < picHeight; i++ )
if ( m_classifier == nullptr )
{
m_classifier[i] = new AlfClassifier[picWidth];
m_classifier = new AlfClassifier*[picHeight];
for( int i = 0; i < picHeight; i++ )
{
m_classifier[i] = new AlfClassifier[picWidth];
}
}
}
......
......@@ -195,7 +195,7 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i
ctx += leftCTUAddr > -1 ? ( ctbAlfFlag[leftCTUAddr] ? 1 : 0 ) : 0;
ctx += aboveCTUAddr > -1 ? ( ctbAlfFlag[aboveCTUAddr] ? 1 : 0 ) : 0;
if( alfSliceParam.chromaCtbPresentFlag && compIdx )
if( compIdx && alfSliceParam.chromaCtbPresentFlag )
{
ctbAlfFlag[ctuRsAddr] = 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment