diff options
author | David Tardon <dtardon@redhat.com> | 2011-05-16 13:27:04 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2011-05-16 15:39:28 +0200 |
commit | f1b0e6c78d6c9d34c4d64348c06833f9907f1b3d (patch) | |
tree | 2b40b504cf393b999b79ec3d29f2220cbc8b0ec0 | |
parent | 4815030a61637b30e3b23e80e682cac1c68df64a (diff) |
do not leak memory
-rw-r--r-- | drawinglayer/source/primitive2d/textlayoutdevice.cxx | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index f4f3077fe0..0ec1263488 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -347,13 +347,9 @@ namespace drawinglayer if(nTextLength) { aRetval.reserve(nTextLength); - sal_Int32* pArray = new sal_Int32[nTextLength]; - mrDevice.GetTextArray(rText, pArray, nIndex, nLength); - - for(sal_uInt32 a(0); a < nTextLength; a++) - { - aRetval.push_back(pArray[a]); - } + ::std::vector<sal_Int32> aArray(nTextLength); + mrDevice.GetTextArray(rText, &aArray[0], nIndex, nLength); + aRetval.assign(aArray.begin(), aArray.end()); } return aRetval; |