[Libreoffice-commits] .: 11 commits - basic/source drawinglayer/source editeng/source framework/source sfx2/source
David Tardon
dtardon at kemper.freedesktop.org
Mon May 16 06:44:42 PDT 2011
basic/source/comp/dim.cxx | 3 +--
basic/source/comp/exprtree.cxx | 2 +-
basic/source/runtime/methods.cxx | 1 +
drawinglayer/source/primitive2d/textlayoutdevice.cxx | 10 +++-------
drawinglayer/source/processor3d/zbufferprocessor3d.cxx | 4 ++--
editeng/source/items/frmitems.cxx | 2 ++
editeng/source/items/xmlcnitm.cxx | 11 ++---------
editeng/source/rtf/rtfgrf.cxx | 9 +++++----
framework/source/fwe/xml/imagesdocumenthandler.cxx | 2 ++
sfx2/source/doc/docvor.cxx | 2 +-
10 files changed, 20 insertions(+), 26 deletions(-)
New commits:
commit cc0ee757d29d40caa6685593fb66507019b2608a
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 15:07:03 2011 +0200
do not leak memory
diff --git a/framework/source/fwe/xml/imagesdocumenthandler.cxx b/framework/source/fwe/xml/imagesdocumenthandler.cxx
index b68d178..3190f8a 100644
--- a/framework/source/fwe/xml/imagesdocumenthandler.cxx
+++ b/framework/source/fwe/xml/imagesdocumenthandler.cxx
@@ -515,6 +515,8 @@ throw( SAXException, RuntimeException )
if ( m_pExternalImages )
m_pExternalImages->Insert( pItem, m_pExternalImages->Count() );
+ else
+ delete pItem;
}
break;
commit 941b23de3e1bfe7ff85f48af0471a55b3516b8f0
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 14:55:07 2011 +0200
avoid possible memory leak
diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx
index 81a1d8e..7a42799 100644
--- a/editeng/source/rtf/rtfgrf.cxx
+++ b/editeng/source/rtf/rtfgrf.cxx
@@ -29,6 +29,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_editeng.hxx"
+#include <boost/scoped_ptr.hpp>
+
#include <osl/endian.h>
#include <tools/cachestr.hxx>
#include <vcl/graph.hxx>
@@ -274,7 +276,7 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
SetSrcEncoding( RTL_TEXTENCODING_MS_1252 );
const sal_Char* pFilterNm = 0;
- SvCacheStream* pTmpFile = 0;
+ boost::scoped_ptr<SvCacheStream> pTmpFile;
int nToken = 0;
bool bValidBmp = true, bFirstTextToken = true;
@@ -326,7 +328,7 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
{
rPicType.eStyle = SvxRTFPictureType::MAC_QUICKDRAW;
// Mac-Pict gets a empty header above
- pTmpFile = new SvCacheStream;
+ pTmpFile.reset(new SvCacheStream);
ByteString aStr;
aStr.Fill( 512, '\0' );
pTmpFile->Write( aStr.GetBuffer(), aStr.Len() );
@@ -373,7 +375,7 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
}
rPicType.nType = nVal;
- pTmpFile = new SvCacheStream;
+ pTmpFile.reset(new SvCacheStream);
}
break;
@@ -503,7 +505,6 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
pTmpFile->Seek( STREAM_SEEK_TO_BEGIN );
bValidBmp = 0 == pGF->ImportGraphic( rGrf, sTmpStr, *pTmpFile, nImportFilter, NULL, 0, pAPMHeader );
}
- delete pTmpFile;
}
if( !bValidBmp )
commit 6eab1c7ca0e780da1d229a6105d83a8fefb76a69
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 14:04:04 2011 +0200
do not leak memory
diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx
index 27aa04a..489841a 100644
--- a/editeng/source/items/xmlcnitm.cxx
+++ b/editeng/source/items/xmlcnitm.cxx
@@ -119,7 +119,7 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal
}
else
{
- SvXMLAttrContainerData* pNewImpl = new SvXMLAttrContainerData;
+ std::auto_ptr<SvXMLAttrContainerData> pNewImpl(new SvXMLAttrContainerData);
try
{
@@ -168,19 +168,12 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal
}
if( nAttr == nCount )
- {
- delete pImpl;
- pImpl = pNewImpl;
- }
+ pImpl = pNewImpl.release();
else
- {
- delete pNewImpl;
return false;
- }
}
catch(...)
{
- delete pNewImpl;
return false;
}
}
commit 78f654561dbe350ae63bab6bf63be16d7eba0d00
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 13:58:49 2011 +0200
do not leak memory
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index e0970a4..ace04fb 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2312,6 +2312,7 @@ void SvxBoxItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine )
pRight = pTmp;
break;
default:
+ delete pTmp;
OSL_FAIL( "wrong line" );
}
}
commit ce3cd34b80f0a68cd756e624c1e0462a076c5595
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 13:57:07 2011 +0200
do not leak memory
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index bda2be7..e0970a4 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2509,6 +2509,7 @@ void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine )
}
else
{
+ delete pTmp;
OSL_FAIL( "wrong line" );
}
}
commit bd69a436a0ebacdd0f4c17b4029b9f3445ad0a5f
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 13:48:55 2011 +0200
release BitmapWriteAccess correctly
diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
index b210d64..3e822a4 100644
--- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
@@ -130,8 +130,8 @@ namespace
}
}
- delete pContent;
- delete pAlpha;
+ aContent.ReleaseAccess(pContent);
+ aAlpha.ReleaseAccess(pAlpha);
}
aRetval = BitmapEx(aContent, aAlpha);
commit f1b0e6c78d6c9d34c4d64348c06833f9907f1b3d
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 13:27:04 2011 +0200
do not leak memory
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index f4f3077..0ec1263 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -347,13 +347,9 @@ namespace drawinglayer
if(nTextLength)
{
aRetval.reserve(nTextLength);
- sal_Int32* pArray = new sal_Int32[nTextLength];
- mrDevice.GetTextArray(rText, pArray, nIndex, nLength);
-
- for(sal_uInt32 a(0); a < nTextLength; a++)
- {
- aRetval.push_back(pArray[a]);
- }
+ ::std::vector<sal_Int32> aArray(nTextLength);
+ mrDevice.GetTextArray(rText, &aArray[0], nIndex, nLength);
+ aRetval.assign(aArray.begin(), aArray.end());
}
return aRetval;
commit 4815030a61637b30e3b23e80e682cac1c68df64a
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 12:37:45 2011 +0200
delete[] after use
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 16333e0..a7218d2 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3978,6 +3978,7 @@ RTLFUNC(StrConv)
}
pChar[nSize] = '\0';
::rtl::OString aOStr(pChar);
+ delete[] pChar;
// there is no concept about default codepage in unix. so it is incorrectly in unix
::rtl::OUString aOUStr = ::rtl::OStringToOUString(aOStr, osl_getThreadTextEncoding());
commit ca981aacc05aad37955a338096826a61cf43a708
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 12:31:19 2011 +0200
delete even in case of error
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 8fae1a4..7bb42a6 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -593,7 +593,6 @@ void SbiParser::DefType( sal_Bool bPrivate )
break;
default:
- pDim = NULL;
pElem = VarDecl(&pDim,sal_False,sal_False);
if( !pElem )
bDone = sal_True; // Error occurred
@@ -659,9 +658,9 @@ void SbiParser::DefType( sal_Bool bPrivate )
}
}
}
- delete pDim;
pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() );
}
+ delete pDim, pDim = NULL;
delete pElem;
}
}
commit d6bbd5d14c1c920f0a93e6791517450b905f5e3b
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 12:10:42 2011 +0200
this looks incorrect
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 6191808..cbb789c 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -253,7 +253,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
pvMoreParLcl = new SbiExprListVector();
SbiParameters* pAddPar = new SbiParameters( pParser );
pvMoreParLcl->push_back( pAddPar );
- bError |= !pPar->IsValid();
+ bError |= !pAddPar->IsValid();
eTok = pParser->Peek();
}
}
commit 8b48ebc169d105f1384cbadcf0d5d3b1592196b5
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 16 10:06:27 2011 +0200
avoid array overrun
diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index 23c359a..ccee46a 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -718,7 +718,7 @@ sal_Bool SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox,
pChildIter = NextSibling(pChildIter);
// If possible, fill in Items onDemand
++i;
- if(p[i+1] != INDEX_IGNORE &&
+ if(i < 2 && p[i+1] != INDEX_IGNORE &&
pChildIter->HasChildsOnDemand() &&
!GetModel()->HasChilds(pChildIter))
RequestingChilds(pChildIter);
More information about the Libreoffice-commits
mailing list