fix memory leak in array xls import

The ScMatrix instances are leaked because there is no DecRef called on
them when we Reset the TokenPool.

Change-Id: Ie5e1a10c6be94b45df784c04f6db744928f213ff
Reviewed-on: https://gerrit.libreoffice.org/23194
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
Markus Mohrhard
2016-03-13 19:15:16 +01:00
parent 98d48dad9e
commit 3887e8439a
2 changed files with 15 additions and 5 deletions

View File

@@ -126,11 +126,7 @@ TokenPool::~TokenPool()
delete ppP_Nlf[ n ];
delete[] ppP_Nlf;
for( n = 0 ; n < nP_Matrix ; n++ )
{
if( ppP_Matrix[ n ] )
ppP_Matrix[ n ]->DecRef( );
}
ClearMatrix();
delete[] ppP_Matrix;
delete pScToken;
@@ -879,6 +875,7 @@ void TokenPool::Reset()
maExtNames.clear();
maExtCellRefs.clear();
maExtAreaRefs.clear();
ClearMatrix();
}
bool TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const
@@ -934,4 +931,16 @@ ScMatrix* TokenPool::GetMatrix( unsigned int n ) const
return nullptr;
}
void TokenPool::ClearMatrix()
{
for(sal_uInt16 n = 0 ; n < nP_Matrix ; n++ )
{
if( ppP_Matrix[ n ] )
{
ppP_Matrix[ n ]->DecRef( );
ppP_Matrix[n] = nullptr;
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -182,6 +182,7 @@ private:
bool GrowMatrix();
bool GetElement( const sal_uInt16 nId );
bool GetElementRek( const sal_uInt16 nId );
void ClearMatrix();
public:
TokenPool( svl::SharedStringPool& rSPool );
~TokenPool();