[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue Mar 29 13:56:04 UTC 2016
sc/source/filter/excel/tokstack.cxx | 19 ++++++++++++++-----
sc/source/filter/inc/tokstack.hxx | 5 +++--
2 files changed, 17 insertions(+), 7 deletions(-)
New commits:
commit dc609320c7594d8c9378c3c06b94935b2572fbdb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Mar 13 19:15:16 2016 +0100
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.
Reviewed-on: https://gerrit.libreoffice.org/23194
Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Conflicts:
sc/source/filter/inc/tokstack.hxx
Change-Id: Ie5e1a10c6be94b45df784c04f6db744928f213ff
Reviewed-on: https://gerrit.libreoffice.org/23488
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx
index 1a8a399..b52b5ba 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -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;
@@ -881,6 +877,7 @@ void TokenPool::Reset()
maExtNames.clear();
maExtCellRefs.clear();
maExtAreaRefs.clear();
+ ClearMatrix();
}
bool TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const
@@ -936,4 +933,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: */
diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx
index b103179..5b91bfb 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -187,8 +187,9 @@ private:
bool GrowExt();
bool GrowNlf();
bool GrowMatrix();
- bool GetElement( const sal_uInt16 nId );
- bool GetElementRek( const sal_uInt16 nId );
+ bool GetElement( const sal_uInt16 nId );
+ bool GetElementRek( const sal_uInt16 nId );
+ void ClearMatrix();
public:
TokenPool( svl::SharedStringPool& rSPool );
~TokenPool();
More information about the Libreoffice-commits
mailing list