summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-16 08:59:19 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-16 09:15:44 +0100
commit88f46523ec82663ce28219369f70fb1c4e369e80 (patch)
tree77873f955276078df3e322f1818150ea5ddfe5e1 /sw
parent541f9b96bec7caacf42f724ad2399d484502b2e2 (diff)
ofz#1632 direct leak
Change-Id: Ib1c347f9ee15717ce17b3189b07f3622efd8d689
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx1
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx18
3 files changed, 7 insertions, 14 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 16525583f557..558b8715a1ed 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4178,7 +4178,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
, m_pStandardFormatColl(nullptr)
, m_pHdFt(nullptr)
, m_pTableDesc(nullptr)
- , m_pNumOlst(nullptr)
, m_pDrawModel(nullptr)
, m_pDrawPg(nullptr)
, m_pDrawEditEngine(nullptr)
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index fdec37c9bd7a..b859a030ef5b 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1223,7 +1223,7 @@ private:
std::stack<WW8TabDesc*> m_aTableStack;
ANLDRuleMap m_aANLDRules;
- WW8_OLST* m_pNumOlst; // position in text
+ std::unique_ptr<WW8_OLST> m_xNumOlst; // position in text
SdrModel* m_pDrawModel;
SdrPage* m_pDrawPg;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index efa5ecaa985e..ecd8f93978fc 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -986,24 +986,18 @@ void SwWW8ImplReader::SetNumOlst(SwNumRule* pNumR, WW8_OLST* pO, sal_uInt8 nSwLe
// when outline-paragraphs occur.
void SwWW8ImplReader::Read_OLST( sal_uInt16, const sal_uInt8* pData, short nLen )
{
- delete m_pNumOlst;
+ m_xNumOlst.reset();
if (nLen <= 0)
- {
- m_pNumOlst = nullptr;
return;
- }
if (static_cast<size_t>(nLen) < sizeof(WW8_OLST))
{
SAL_WARN("sw.ww8", "WW8_OLST property is " << nLen << " long, needs to be at least " << sizeof(WW8_OLST));
- m_pNumOlst = nullptr;
return;
}
- m_pNumOlst = new WW8_OLST;
- if( nLen < sal::static_int_cast< sal_Int32 >(sizeof( WW8_OLST )) ) // fill if to short
- memset( m_pNumOlst, 0, sizeof( *m_pNumOlst ) );
- *m_pNumOlst = *reinterpret_cast<WW8_OLST const *>(pData);
+ m_xNumOlst.reset(new WW8_OLST);
+ *m_xNumOlst = *reinterpret_cast<WW8_OLST const *>(pData);
}
WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)
@@ -1135,16 +1129,16 @@ void SwWW8ImplReader::NextAnlLine(const sal_uInt8* pSprm13)
// undefined
if (!pNumRule->GetNumFormat(m_nSwNumLevel))
{
- if (m_pNumOlst) // there was a OLST
+ if (m_xNumOlst) // there was a OLST
{
//Assure upper levels are set, #i9556#
for (sal_uInt8 nI = 0; nI < m_nSwNumLevel; ++nI)
{
if (!pNumRule->GetNumFormat(nI))
- SetNumOlst(pNumRule, m_pNumOlst, nI);
+ SetNumOlst(pNumRule, m_xNumOlst.get(), nI);
}
- SetNumOlst(pNumRule, m_pNumOlst , m_nSwNumLevel);
+ SetNumOlst(pNumRule, m_xNumOlst.get(), m_nSwNumLevel);
}
else // no Olst -> use Anld
{