summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-10-02 22:43:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-10-02 23:19:52 +0100
commit19a23df7f2dcdba88edd507ddd6d6201f1eeb1bc (patch)
tree7139adb6e78ba3a69ba21602f645a8ed5571ae47 /lotuswordpro
parentd820977d6aedc8447d50862751adb61cadf488c9 (diff)
valgrind: fix some leaks
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/localtime.cxx1
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.cxx43
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.cxx7
-rw-r--r--lotuswordpro/source/filter/lwpobjstrm.cxx7
-rw-r--r--lotuswordpro/source/filter/lwppara1.cxx4
-rw-r--r--lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx19
-rw-r--r--lotuswordpro/source/filter/xfilter/xfconfigmanager.hxx1
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx3
8 files changed, 40 insertions, 45 deletions
diff --git a/lotuswordpro/source/filter/localtime.cxx b/lotuswordpro/source/filter/localtime.cxx
index 1eee2bfab2d4..9d25acaa054b 100644
--- a/lotuswordpro/source/filter/localtime.cxx
+++ b/lotuswordpro/source/filter/localtime.cxx
@@ -185,6 +185,7 @@ bool LtgLocalTime(long rtime,LtTm& rtm)
{
TimeZone* pLocalZone = TimeZone::createDefault();
long offset = (pLocalZone->getRawOffset())/1000;
+ delete pLocalZone;
long ltime = rtime + offset;
return LtgGmTime(ltime,rtm);
}
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index e1f35522cd24..dcbe10d52a0d 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -764,16 +764,11 @@ void LwpFrameLink::Read(LwpObjectStream* pStrm)
LwpFrameLayout::LwpFrameLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
: LwpPlacableLayout(objHdr, pStrm), m_pFrame(NULL)
{
-
}
LwpFrameLayout::~LwpFrameLayout()
{
- if(m_pFrame)
- {
- delete m_pFrame;
- m_pFrame = NULL;
- }
+ delete m_pFrame;
}
/**
@@ -856,10 +851,12 @@ void LwpFrameLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
void LwpFrameLayout::RegisterStyle()
{
//if it is for water mark, don't register style
- if(IsForWaterMark())
- {
+ if (IsForWaterMark())
return;
- }
+
+ if (m_pFrame)
+ return;
+
//register frame style
XFFrameStyle* pFrameStyle = new XFFrameStyle();
m_pFrame = new LwpFrame(this);
@@ -875,9 +872,8 @@ void LwpFrameLayout::RegisterStyle()
//register child frame style
RegisterChildStyle();
-
-
}
+
/**
* @descr get the name of the frame that current frame links
*
@@ -1021,18 +1017,15 @@ void LwpFrameLayout::ApplyGraphicSize(XFFrame * pXFFrame)
}
LwpGroupLayout::LwpGroupLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
- : LwpPlacableLayout(objHdr, pStrm),m_pFrame(NULL)
+ : LwpPlacableLayout(objHdr, pStrm)
+ , m_pFrame(NULL)
{
}
LwpGroupLayout::~LwpGroupLayout()
{
- if(m_pFrame)
- {
- delete m_pFrame;
- m_pFrame = NULL;
- }
+ delete m_pFrame;
}
/**
* @descr read group layout object
@@ -1049,6 +1042,9 @@ void LwpGroupLayout::Read()
*/
void LwpGroupLayout::RegisterStyle()
{
+ if (m_pFrame)
+ return;
+
//register frame style
XFFrameStyle* pFrameStyle = new XFFrameStyle();
m_pFrame = new LwpFrame(this);
@@ -1056,15 +1052,6 @@ void LwpGroupLayout::RegisterStyle()
//register child frame style
RegisterChildStyle();
- /*
- LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
- while(pLayout)
- {
- pLayout->SetFoundry(m_pFoundry);
- pLayout->RegisterStyle();
- pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
- }
- */
}
/**
* @descr create a xfframe and add into content container
@@ -1134,9 +1121,11 @@ void LwpGroupFrame::Read()
m_pObjStrm->SkipExtra();
}
- void LwpGroupFrame::RegisterStyle()
+
+void LwpGroupFrame::RegisterStyle()
{
}
+
void LwpGroupFrame::XFConvert(XFContentContainer* /*pCont*/)
{
}
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 1c46c2ea9952..f836c7afc723 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -100,10 +100,11 @@ LwpGraphicObject::LwpGraphicObject(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
memset(m_sDataFormat, 0, sizeof(m_sDataFormat));
memset(m_sServerContextFormat, 0, sizeof(m_sServerContextFormat));
}
+
LwpGraphicObject::~LwpGraphicObject()
{
- m_vXFDrawObjects.clear();
}
+
void LwpGraphicObject::Read()
{
LwpGraphicOleObject::Read();
@@ -213,7 +214,6 @@ void LwpGraphicObject::XFConvert (XFContentContainer* pCont)
std::vector <XFFrame*>::iterator iter;
for (iter = m_vXFDrawObjects.begin(); iter != m_vXFDrawObjects.end(); ++iter)
{
- //pPara->Add(*iter);
pCont->Add(*iter);
}
@@ -457,7 +457,6 @@ sal_uInt32 LwpGraphicObject::GetGrafData(sal_uInt8*& pGrafData)
*/
void LwpGraphicObject::CreateGrafObject()
{
-
XFImage* pImage = new XFImage();
// set image processing styles
@@ -594,8 +593,6 @@ void LwpGraphicObject::CreateGrafObject()
else
{
// set left-top alignment
-// pImageStyle->SetXPosType(enumXFFrameXPosLeft, enumXFFrameXRelFrame);
-// pImageStyle->SetYPosType(enumXFFrameYPosTop, enumXFFrameYRelFrame);
pImageStyle->SetYPosType(enumXFFrameYPosFromTop, enumXFFrameYRelFrame);
pImageStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx
index c7a31773ace8..b9dc3926eaad 100644
--- a/lotuswordpro/source/filter/lwpobjstrm.cxx
+++ b/lotuswordpro/source/filter/lwpobjstrm.cxx
@@ -60,6 +60,7 @@
#include "lwpobjstrm.hxx"
#include "lwptools.hxx"
+#include <boost/scoped_array.hpp>
/**
* @descr ctor() from LwpSvStream
@@ -99,15 +100,15 @@ void LwpObjectStream::Read2Buffer()
if( m_bCompressed )
{
- sal_uInt8* pCompressBuffer = new sal_uInt8[m_nBufSize];
+ boost::scoped_array<sal_uInt8> xCompressBuf(new sal_uInt8[m_nBufSize]);
+
+ sal_uInt8* pCompressBuffer = xCompressBuf.get();
memset(pCompressBuffer, 0, m_nBufSize);
m_pStrm->Read(pCompressBuffer, m_nBufSize);
sal_uInt8 pTempDst[IO_BUFFERSIZE];
m_nBufSize = DecompressBuffer(pTempDst, pCompressBuffer, m_nBufSize);
assert( m_nBufSize < IO_BUFFERSIZE);
- delete [] pCompressBuffer;
- pCompressBuffer = NULL;
m_pContentBuf = AllocBuffer(m_nBufSize);
memcpy(m_pContentBuf, pTempDst, m_nBufSize);
diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx
index 6b99b6aabd52..30f33fa6c40a 100644
--- a/lotuswordpro/source/filter/lwppara1.cxx
+++ b/lotuswordpro/source/filter/lwppara1.cxx
@@ -356,7 +356,7 @@ void LwpPara::OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyl
LwpOverride* pBorder = pParaStyle->GetParaBorder();
SAL_WNODEPRECATED_DECLARATIONS_PUSH
- std::auto_ptr<LwpParaBorderOverride> pFinalBorder(
+ boost::scoped_ptr<LwpParaBorderOverride> pFinalBorder(
pBorder
? polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone())
: new LwpParaBorderOverride)
@@ -372,7 +372,7 @@ void LwpPara::OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyl
pLocalBorder->Override(pFinalBorder.get());
}
- pParaStyle->ApplyParaBorder(pOverStyle, pFinalBorder.release());
+ pParaStyle->ApplyParaBorder(pOverStyle, pFinalBorder.get());
}
/**
* @short: Override parabreaks style.
diff --git a/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
index 9a1f9b72807e..598363e12946 100644
--- a/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx
@@ -60,13 +60,21 @@
#include "xfconfigmanager.hxx"
XFConfigManager::XFConfigManager()
+ : m_pLineNumberConfig(0)
+ , m_pFootnoteConfig(0)
+ , m_pEndnoteConfig(0)
+
{
- m_pLineNumberConfig = NULL;
- m_pFootnoteConfig = NULL;
- m_pEndnoteConfig = NULL;
}
-void XFConfigManager::SetLineNumberConfig(XFLineNumberConfig *pLNConfig)
+XFConfigManager::~XFConfigManager()
+{
+ delete m_pEndnoteConfig;
+ delete m_pFootnoteConfig;
+ delete m_pLineNumberConfig;
+}
+
+void XFConfigManager::SetLineNumberConfig(XFLineNumberConfig *pLNConfig)
{
if( m_pLineNumberConfig )
delete m_pLineNumberConfig;
@@ -82,8 +90,7 @@ void XFConfigManager::SetFootnoteConfig(XFFootnoteConfig *pFNConfig)
void XFConfigManager::SetEndnoteConfig(XFEndnoteConfig *pENConfig)
{
- if( m_pEndnoteConfig )
- delete m_pEndnoteConfig;
+ delete m_pEndnoteConfig;
m_pEndnoteConfig = pENConfig;
}
diff --git a/lotuswordpro/source/filter/xfilter/xfconfigmanager.hxx b/lotuswordpro/source/filter/xfilter/xfconfigmanager.hxx
index 44a9c10fbfe6..e1f9481c73bb 100644
--- a/lotuswordpro/source/filter/xfilter/xfconfigmanager.hxx
+++ b/lotuswordpro/source/filter/xfilter/xfconfigmanager.hxx
@@ -76,6 +76,7 @@ class XFConfigManager : public XFStyleContainer
{
public:
XFConfigManager();
+ ~XFConfigManager();
public:
/**
diff --git a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
index 9a98ee389bc8..3eaac061109d 100644
--- a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx
@@ -104,8 +104,7 @@ XFContentContainer::~XFContentContainer()
for( it = m_aContents.begin(); it != m_aContents.end(); ++it )
{
IXFContent *pContent = *it;
- if( pContent )
- delete pContent;
+ delete pContent;
}
}