summaryrefslogtreecommitdiff
path: root/svx/source/table
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2014-06-30 11:33:26 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2014-06-30 11:44:16 +0900
commitb20e6acea2cb2013f450bb4b97b51142dbb4f161 (patch)
treee441dfb4fdca68c9c0cd2f76cbf955d93b0a74d8 /svx/source/table
parentd4feafb064560f27fce8ed3e760325545e7ba539 (diff)
Avoid possible memory leaks in case of exceptions
Change-Id: I9a92edd7886db484f1333585545f6f63a233a6dd
Diffstat (limited to 'svx/source/table')
-rw-r--r--svx/source/table/tablecontroller.cxx5
-rw-r--r--svx/source/table/tablertfimporter.cxx4
2 files changed, 4 insertions, 5 deletions
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 86c4f95649d4..4404c4709abe 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -397,7 +397,7 @@ void SvxTableController::GetState( SfxItemSet& rSet )
if( !mxTable.is() || !mxTableObj.is() || !mxTableObj->GetModel() )
return;
- SfxItemSet* pSet = 0;
+ boost::scoped_ptr<SfxItemSet> pSet;
bool bVertDone = false;
@@ -420,7 +420,7 @@ void SvxTableController::GetState( SfxItemSet& rSet )
{
if( !pSet )
{
- pSet = new SfxItemSet( mxTableObj->GetModel()->GetItemPool() );
+ pSet.reset(new SfxItemSet( mxTableObj->GetModel()->GetItemPool() ));
MergeAttrFromSelectedCells(*pSet, false);
}
@@ -487,7 +487,6 @@ void SvxTableController::GetState( SfxItemSet& rSet )
}
nWhich = aIter.NextWhich();
}
- delete pSet;
}
diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx
index 2e93278b70d1..fa7b635d7133 100644
--- a/svx/source/table/tablertfimporter.cxx
+++ b/svx/source/table/tablertfimporter.cxx
@@ -19,6 +19,7 @@
#include <vector>
+#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <com/sun/star/table/XTable.hpp>
@@ -272,14 +273,13 @@ void SdrTableRTFParser::FillTable()
if( xCellInfo->maItemSet.GetItemState(SDRATTR_TABLE_BORDER,false,&pPoolItem)==SFX_ITEM_SET)
xCell->SetMergedItem( *pPoolItem );
- OutlinerParaObject* pTextObject = mpOutliner->CreateParaObject( xCellInfo->mnStartPara, xCellInfo->mnParaCount );
+ boost::scoped_ptr<OutlinerParaObject> pTextObject(mpOutliner->CreateParaObject( xCellInfo->mnStartPara, xCellInfo->mnParaCount ));
if( pTextObject )
{
SdrOutliner& rOutliner=mrTableObj.ImpGetDrawOutliner();
rOutliner.SetUpdateMode(true);
rOutliner.SetText( *pTextObject );
mrTableObj.NbcSetOutlinerParaObjectForText( rOutliner.CreateParaObject(), xCell.get() );
- delete pTextObject;
}
}
}