diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-04-21 22:29:09 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-04-21 22:29:09 +0900 |
commit | 1a5457a11c062be8c41cc00813c092b78aa42b8b (patch) | |
tree | 22bf3a3929b91e8e9629bd43ea5e64f791e673dd /l10ntools/source | |
parent | aa8820bdc2c5d22c46119b2afcea0466951745de (diff) |
Avoid possible memory leaks in case of exceptions
Change-Id: I4b2b439615db0ff4598f405d1e339eebbff7ae91
Diffstat (limited to 'l10ntools/source')
-rw-r--r-- | l10ntools/source/xrmmerge.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index f3705fa7b17f..37190fb58623 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -33,6 +33,7 @@ #include <iostream> #include <fstream> #include <vector> +#include <boost/scoped_array.hpp> using namespace std; @@ -327,13 +328,12 @@ void XRMResExport::WorkOnDesc( ifstream file (sDescFileName.getStr(), ios::in|ios::binary|ios::ate); if (file.is_open()) { int size = static_cast<int>(file.tellg()); - char* memblock = new char [size+1]; + boost::scoped_array<char> memblock(new char [size+1]); file.seekg (0, ios::beg); - file.read (memblock, size); + file.read (memblock.get(), size); file.close(); memblock[size] = '\0'; - rText = OString(memblock); - delete[] memblock; + rText = OString(memblock.get()); } WorkOnText( rOpenTag, rText ); EndOfText( rOpenTag, rOpenTag ); |