summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2014-11-06 12:54:02 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2014-11-06 12:56:01 +0900
commit8b21b5cbe78945b27525b4ce78ae3d981f90590f (patch)
tree96e17ca30002b401b8aedaee2894d22446623c38 /starmath
parentd59b9b4af36148e4d8df8f3e3492116d378642e2 (diff)
Avoid possible memory leaks in case of exception
Change-Id: Ie8c1a3e54bda4ec650f5d5da3928d3c44e4008a8
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/node.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 7c93b1463011..bb2006a6428a 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -36,7 +36,7 @@
#include <math.h>
#include <float.h>
-
+#include <boost/scoped_array.hpp>
SmNode::SmNode(SmNodeType eNodeType, const SmToken &rNodeToken)
@@ -2558,7 +2558,7 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
// initialize array that is to hold the maximum widths of all
// elements (subnodes) in that column.
- long *pColWidth = new long[nNumCols];
+ boost::scoped_array<long> pColWidth(new long[nNumCols]);
for (j = 0; j < nNumCols; j++)
pColWidth[j] = 0;
@@ -2584,7 +2584,7 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
nVerDist = nNormDist * rFormat.GetDistance(DIS_MATRIXROW) / 100L;
// build array that holds the leftmost position for each column
- long *pColLeft = new long[nNumCols];
+ boost::scoped_array<long> pColLeft(new long[nNumCols]);
long nX = 0;
for (j = 0; j < nNumCols; j++)
{ pColLeft[j] = nX;
@@ -2644,9 +2644,6 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
ExtendBy(aLineRect, RCP_NONE);
}
-
- delete [] pColLeft;
- delete [] pColWidth;
}