summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-01 11:41:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-03-01 11:41:17 +0000
commit86463ec54dcdc562121bdb57b1ac4e85b135b2df (patch)
tree6af4300c55936d18123f596a42f07daa4f48d38e /hwpfilter
parentaacaacc16938b030a1341d8dbaf56c6a2efeb1dc (diff)
ofz#711: direct leak
Change-Id: I65ec47b4290d845f1803b20b93f149d35d9a60ea
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hinfo.h5
-rw-r--r--hwpfilter/source/hwpfile.cxx4
-rw-r--r--hwpfilter/source/hwpreader.cxx2
3 files changed, 6 insertions, 5 deletions
diff --git a/hwpfilter/source/hinfo.h b/hwpfilter/source/hinfo.h
index d16da5d09013..7f1eee0657c7 100644
--- a/hwpfilter/source/hinfo.h
+++ b/hwpfilter/source/hinfo.h
@@ -23,6 +23,8 @@
#include "hwplib.h"
#include "string.h"
+#include <vector>
+
#define CHAIN_MAX_PATH 40
#define ANNOTATION_LEN 24
@@ -77,7 +79,7 @@ struct PaperBackInfo
int range; /* 0-????, 1-????????, 3-??????, 4-?????? */
char reserved3[27];
int size;
- char *data; // image data
+ std::vector<char> data; // image data
bool isset;
PaperBackInfo()
: type(0)
@@ -87,7 +89,6 @@ struct PaperBackInfo
, flag(0)
, range(0)
, size(0)
- , data(nullptr)
, isset(false)
{
memset(reserved1, 0, sizeof(reserved1));
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index 0ce390297563..33505c0f733e 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -356,8 +356,8 @@ void HWPFile::TagsRead()
return;
}
- _hwpInfo.back_info.data = new char[(unsigned int)_hwpInfo.back_info.size];
- ReadBlock(_hwpInfo.back_info.data, _hwpInfo.back_info.size);
+ _hwpInfo.back_info.data.resize(_hwpInfo.back_info.size);
+ ReadBlock(_hwpInfo.back_info.data.data(), _hwpInfo.back_info.size);
if( _hwpInfo.back_info.size > 0 )
_hwpInfo.back_info.type = 2;
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 53fd08074711..5e499e7fd471 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -1736,7 +1736,7 @@ void HwpReader::makePageStyle()
if( hwpinfo.back_info.type == 2 ){
rstartEl("office:binary-data", mxList.get());
mxList->clear();
- std::shared_ptr<char> pStr(base64_encode_string(reinterpret_cast<unsigned char *>(hwpinfo.back_info.data), hwpinfo.back_info.size ), Free<char>());
+ std::shared_ptr<char> pStr(base64_encode_string(reinterpret_cast<unsigned char *>(hwpinfo.back_info.data.data()), hwpinfo.back_info.size ), Free<char>());
rchars(ascii(pStr.get()));
rendEl("office:binary-data");
}