summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-22 18:23:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-23 08:55:14 +0200
commitf8ffedfd3c05b7526d934f53f7f5f0ee2dd4fb78 (patch)
tree1a00277c560ec886e7e1503b398bd11395e69460 /sw/source/core
parent6cdfd89413eab85dba7b975199358cb8fae44661 (diff)
fix leak in SwUndoFormatCreate
Change-Id: Ie6f67c71fa87c78ea57c70f765024b76be1b0a0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115991 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/inc/SwUndoFmt.hxx3
-rw-r--r--sw/source/core/undo/SwUndoFmt.cxx4
2 files changed, 4 insertions, 3 deletions
diff --git a/sw/source/core/inc/SwUndoFmt.hxx b/sw/source/core/inc/SwUndoFmt.hxx
index b91eec91d539..f02776339c90 100644
--- a/sw/source/core/inc/SwUndoFmt.hxx
+++ b/sw/source/core/inc/SwUndoFmt.hxx
@@ -23,6 +23,7 @@
#include <undobj.hxx>
#include <swundo.hxx>
#include <numrule.hxx>
+#include <memory>
class SwDoc;
class SwTextFormatColl;
@@ -36,7 +37,7 @@ protected:
OUString m_sDerivedFrom;
SwDoc& m_rDoc;
mutable OUString m_sNewName;
- SfxItemSet * m_pNewSet;
+ std::unique_ptr<SfxItemSet> m_pNewSet;
sal_uInt16 m_nId; // FormatId related
bool m_bAuto;
diff --git a/sw/source/core/undo/SwUndoFmt.cxx b/sw/source/core/undo/SwUndoFmt.cxx
index 818cf7e751e1..110f138f5f3b 100644
--- a/sw/source/core/undo/SwUndoFmt.cxx
+++ b/sw/source/core/undo/SwUndoFmt.cxx
@@ -31,7 +31,7 @@
SwUndoFormatCreate::SwUndoFormatCreate
(SwUndoId nUndoId, SwFormat * _pNew, SwFormat const * _pDerivedFrom, SwDoc& rDoc)
: SwUndo(nUndoId, &rDoc), m_pNew(_pNew),
- m_rDoc(rDoc), m_pNewSet(nullptr), m_nId(0), m_bAuto(false)
+ m_rDoc(rDoc), m_nId(0), m_bAuto(false)
{
if (_pDerivedFrom)
m_sDerivedFrom = _pDerivedFrom->GetName();
@@ -54,7 +54,7 @@ void SwUndoFormatCreate::UndoImpl(::sw::UndoRedoContext &)
if (m_pNew)
{
- m_pNewSet = new SfxItemSet(m_pNew->GetAttrSet());
+ m_pNewSet.reset(new SfxItemSet(m_pNew->GetAttrSet()));
m_nId = m_pNew->GetPoolFormatId() & COLL_GET_RANGE_BITS;
m_bAuto = m_pNew->IsAuto();