summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-22 13:25:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-23 09:31:20 +0200
commitd1e47b1428abf1732ab4d5e219b210760d4152e0 (patch)
tree8eac1def834ba548c45a8a1a18e8e39d45eedc1d /hwpfilter
parent919a4ef592b6026a7533a93682f39118fef29ce8 (diff)
enhance useuniqueptr loplugin
teach it to look for the following sequence in a destructor: delete m_pfoo; m_pfoo = nullptr; Change-Id: Icd6271a63a024e32b53cc9e599f8f59952160380 Reviewed-on: https://gerrit.libreoffice.org/37900 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hinfo.cxx6
-rw-r--r--hwpfilter/source/hinfo.h3
2 files changed, 4 insertions, 5 deletions
diff --git a/hwpfilter/source/hinfo.cxx b/hwpfilter/source/hinfo.cxx
index 2e5d4b1c9a16..3d262b5c7d1e 100644
--- a/hwpfilter/source/hinfo.cxx
+++ b/hwpfilter/source/hinfo.cxx
@@ -66,8 +66,6 @@ HWPInfo::HWPInfo()
HWPInfo::~HWPInfo()
{
- delete[] info_block;
- info_block = nullptr;
}
@@ -163,9 +161,9 @@ void HWPInfo::Read(HWPFile & hwpf)
return;
if (info_block_len > 0)
{
- info_block = new unsigned char[info_block_len + 1];
+ info_block.reset( new unsigned char[info_block_len + 1] );
- if (!HWPReadInfoBlock(info_block, info_block_len, hwpf))
+ if (!HWPReadInfoBlock(info_block.get(), info_block_len, hwpf))
return;
}
diff --git a/hwpfilter/source/hinfo.h b/hwpfilter/source/hinfo.h
index 7f1eee0657c7..a381cc1dfb59 100644
--- a/hwpfilter/source/hinfo.h
+++ b/hwpfilter/source/hinfo.h
@@ -24,6 +24,7 @@
#include "string.h"
#include <vector>
+#include <memory>
#define CHAIN_MAX_PATH 40
#define ANNOTATION_LEN 24
@@ -201,7 +202,7 @@ class DLLEXPORT HWPInfo
* Summary of document
*/
HWPSummary summary;
- unsigned char *info_block;
+ std::unique_ptr<unsigned char[]> info_block;
HWPInfo(void);
~HWPInfo(void);