Kaydet (Commit) 8b21b5cb authored tarafından Takeshi Abe's avatar Takeshi Abe

Avoid possible memory leaks in case of exception

Change-Id: Ie8c1a3e54bda4ec650f5d5da3928d3c44e4008a8
üst d59b9b4a
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#include <boost/scoped_array.hpp>
SmNode::SmNode(SmNodeType eNodeType, const SmToken &rNodeToken) SmNode::SmNode(SmNodeType eNodeType, const SmToken &rNodeToken)
...@@ -2558,7 +2558,7 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) ...@@ -2558,7 +2558,7 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
// initialize array that is to hold the maximum widths of all // initialize array that is to hold the maximum widths of all
// elements (subnodes) in that column. // elements (subnodes) in that column.
long *pColWidth = new long[nNumCols]; boost::scoped_array<long> pColWidth(new long[nNumCols]);
for (j = 0; j < nNumCols; j++) for (j = 0; j < nNumCols; j++)
pColWidth[j] = 0; pColWidth[j] = 0;
...@@ -2584,7 +2584,7 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) ...@@ -2584,7 +2584,7 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
nVerDist = nNormDist * rFormat.GetDistance(DIS_MATRIXROW) / 100L; nVerDist = nNormDist * rFormat.GetDistance(DIS_MATRIXROW) / 100L;
// build array that holds the leftmost position for each column // 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; long nX = 0;
for (j = 0; j < nNumCols; j++) for (j = 0; j < nNumCols; j++)
{ pColLeft[j] = nX; { pColLeft[j] = nX;
...@@ -2644,9 +2644,6 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) ...@@ -2644,9 +2644,6 @@ void SmMatrixNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
ExtendBy(aLineRect, RCP_NONE); ExtendBy(aLineRect, RCP_NONE);
} }
delete [] pColLeft;
delete [] pColWidth;
} }
......
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