diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-04-15 15:08:24 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-04-15 16:12:31 +0900 |
commit | eb4c43aa61c08f88acfe5dd1499de0f8dbda4b8b (patch) | |
tree | 4b80faf3c545dceb999eee438a0ed6469049cbe9 /formula | |
parent | 1ac4eb946680ed738cb26be4d43f9716ba8feb17 (diff) |
Avoid possible memory leaks in case of exceptions
Change-Id: Ie07c6c9989da444eb6052691696e95b808c23fb0
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/core/api/token.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 197d62f1760f..c5d7da7ee28c 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -30,6 +30,7 @@ #include "formula/FormulaCompiler.hxx" #include <formula/compiler.hrc> #include <svl/sharedstringpool.hxx> +#include <boost/scoped_array.hpp> namespace formula { @@ -861,7 +862,7 @@ bool FormulaTokenArray::HasMatrixDoubleRefOps() { // RPN-Interpreter Simulation // als Ergebnis jeder Funktion wird einfach ein Double angenommen - FormulaToken** pStack = new FormulaToken* [nRPN]; + boost::scoped_array<FormulaToken*> pStack(new FormulaToken* [nRPN]); FormulaToken* pResult = new FormulaDoubleToken( 0.0 ); short sp = 0; for ( sal_uInt16 j = 0; j < nRPN; j++ ) @@ -890,7 +891,6 @@ bool FormulaTokenArray::HasMatrixDoubleRefOps() if ( sp >= k && pStack[sp-k]->GetType() == svDoubleRef ) { pResult->Delete(); - delete [] pStack; return true; } } @@ -920,7 +920,6 @@ bool FormulaTokenArray::HasMatrixDoubleRefOps() } } pResult->Delete(); - delete [] pStack; } return false; |