summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-19 15:05:00 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-19 18:10:11 +0000
commit8f85595371de1848c9eb85492f04eb0e2bfc9cf5 (patch)
treea5938324069feb5252b4c7b300042593ba71923c /xmloff
parent7b6ffbcc958410035adfd4ed1d4b97991dfb883c (diff)
coverity#1343637 Double free
and coverity#1343638 Double free coverity#1343639 Double free coverity#1343640 Double free coverity#1343641 Double free Change-Id: I8ce42f03d40fe514f73b3a7eabdb4f323b2239e6
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmlictxt.cxx18
-rw-r--r--xmloff/source/transform/TransformerContext.cxx9
-rw-r--r--xmloff/source/transform/TransformerContext.hxx8
3 files changed, 14 insertions, 21 deletions
diff --git a/xmloff/source/core/xmlictxt.cxx b/xmloff/source/core/xmlictxt.cxx
index ff7e4399c911..9629143ae44b 100644
--- a/xmloff/source/core/xmlictxt.cxx
+++ b/xmloff/source/core/xmlictxt.cxx
@@ -23,31 +23,27 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/xml/sax/XLocator.hpp>
-#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmlictxt.hxx>
using namespace ::com::sun::star;
SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp, sal_uInt16 nPrfx,
- const OUString& rLName ) :
- mrImport( rImp ),
- mnPrefix( nPrfx ),
- maLocalName( rLName ),
- mpRewindMap( nullptr )
+ const OUString& rLName )
+ : mrImport(rImp)
+ , mnPrefix(nPrfx)
+ , maLocalName(rLName)
{
}
-SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp ) :
- mrImport( rImp ),
- mnPrefix ( 0 ),
- mpRewindMap( nullptr )
+SvXMLImportContext::SvXMLImportContext( SvXMLImport& rImp )
+ : mrImport(rImp)
+ , mnPrefix(0)
{
}
SvXMLImportContext::~SvXMLImportContext()
{
- delete mpRewindMap;
}
SvXMLImportContext *SvXMLImportContext::CreateChildContext( sal_uInt16 nPrefix,
diff --git a/xmloff/source/transform/TransformerContext.cxx b/xmloff/source/transform/TransformerContext.cxx
index 72adbe6b519f..71b2b44a1171 100644
--- a/xmloff/source/transform/TransformerContext.cxx
+++ b/xmloff/source/transform/TransformerContext.cxx
@@ -22,7 +22,6 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <osl/diagnose.h>
-#include <xmloff/nmspmap.hxx>
#include "TransformerBase.hxx"
@@ -47,16 +46,14 @@ bool XMLTransformerContext::HasNamespace( sal_uInt16 nPrefix ) const
}
XMLTransformerContext::XMLTransformerContext( XMLTransformerBase& rImp,
- const OUString& rQName ) :
- m_rTransformer( rImp ),
- m_aQName( rQName ),
- m_pRewindMap( nullptr )
+ const OUString& rQName )
+ : m_rTransformer(rImp)
+ , m_aQName(rQName)
{
}
XMLTransformerContext::~XMLTransformerContext()
{
- delete m_pRewindMap;
}
rtl::Reference<XMLTransformerContext> XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix,
diff --git a/xmloff/source/transform/TransformerContext.hxx b/xmloff/source/transform/TransformerContext.hxx
index e51443336b81..5d27b3cf63f6 100644
--- a/xmloff/source/transform/TransformerContext.hxx
+++ b/xmloff/source/transform/TransformerContext.hxx
@@ -24,6 +24,7 @@
#include <salhelper/simplereferenceobject.hxx>
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
+#include <xmloff/nmspmap.hxx>
#include <xmloff/xmltoken.hxx>
class SvXMLNamespaceMap;
@@ -37,11 +38,10 @@ class XMLTransformerContext : public ::salhelper::SimpleReferenceObject
OUString m_aQName;
- SvXMLNamespaceMap *m_pRewindMap;
+ std::unique_ptr<SvXMLNamespaceMap> m_xRewindMap;
- SvXMLNamespaceMap *TakeRewindMap()
- { auto p = m_pRewindMap; m_pRewindMap = nullptr; return p; }
- void PutRewindMap( SvXMLNamespaceMap *p ) { m_pRewindMap = p; }
+ SvXMLNamespaceMap *TakeRewindMap() { return m_xRewindMap.release(); }
+ void PutRewindMap( SvXMLNamespaceMap *p ) { m_xRewindMap.reset(p); }
protected: