You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
3.1 KiB
53 lines
3.1 KiB
From cbb4637768e36bb53c9cdfb096398d027ff5ec91 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
Date: Fri, 16 May 2014 16:36:13 +0100
|
|
Subject: [PATCH] coverity: SfxBaseModel's pImpl of fallback TargetDocument for
|
|
paste leaks
|
|
|
|
e.g. repeatedly pasting a metafile into writer and deleting it.
|
|
|
|
==13369== 342 (232 direct, 110 indirect) bytes in 1 blocks are definitely lost in loss record 19,396 of 22,170
|
|
==13369== at 0x4A06965: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
|
|
==13369== by 0x686D72E: SfxBaseModel::SfxBaseModel(SfxObjectShell*) (sfxbasemodel.cxx:518)
|
|
==13369== by 0x288CA9C1: SvxUnoDrawingModel::SvxUnoDrawingModel(SdrModel*) (unomod.cxx:255)
|
|
==13369== by 0x28961055: SvxDrawingLayerImport(SdrModel*, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&, char const*) (xmlexport.cxx:164)
|
|
==13369== by 0x28960FA2: SvxDrawingLayerImport(SdrModel*, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&) (xmlexport.cxx:148)
|
|
==13369== by 0x2896175E: SvxDrawingLayerImport(SdrModel*, com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&) (xmlexport.cxx:254)
|
|
==13369== by 0x240B1002: SwFEShell::Paste(SvStream&, unsigned short, Point const*) (fecopy.cxx:1333)
|
|
==13369== by 0x247B981A: SwTransferable::_PasteSdrFormat(TransferableDataHelper&, SwWrtShell&, unsigned short, Point const*, unsigned char, bool) (swdtflvr.cxx:2207)
|
|
==13369== by 0x247B678E: SwTransferable::PasteData(TransferableDataHelper&, SwWrtShell&, unsigned short, unsigned long, unsigned short, bool, bool, Point const*, signed char, bool) (swdtflvr.cxx:1481)
|
|
==13369== by 0x247B5AE4: SwTransferable::Paste(SwWrtShell&, TransferableDataHelper&) (swdtflvr.cxx:1150)
|
|
==13369== by 0x2488FCCE: SwBaseShell::ExecClpbrd(SfxRequest&) (basesh.cxx:277)
|
|
|
|
Reference< lang::XComponent > xTargetDocument( xComponent );
|
|
if( !xTargetDocument.is() )
|
|
{
|
|
> xTargetDocument = new SvxUnoDrawingModel( pModel );
|
|
pModel->setUnoModel( Reference< XInterface >::query( xTargetDocument ) );
|
|
}
|
|
|
|
Change-Id: I3bd0fc983d9b6bdcdc91071a4ec3d2c584397ebf
|
|
---
|
|
sfx2/source/doc/sfxbasemodel.cxx | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
|
|
index 1de92d6..67096db 100644
|
|
--- a/sfx2/source/doc/sfxbasemodel.cxx
|
|
+++ b/sfx2/source/doc/sfxbasemodel.cxx
|
|
@@ -537,6 +537,11 @@ SfxBaseModel::SfxBaseModel( SfxObjectShell *pObjectShell )
|
|
SfxBaseModel::~SfxBaseModel()
|
|
{
|
|
DBG_DTOR(sfx2_SfxBaseModel,NULL);
|
|
+ //In SvxDrawingLayerImport when !xTargetDocument the fallback SvxUnoDrawingModel created there
|
|
+ //never gets disposed called on it, so m_pData leaks.
|
|
+ IMPL_SfxBaseModel_DataContainer* pData = m_pData;
|
|
+ m_pData = 0;
|
|
+ delete pData;
|
|
}
|
|
|
|
//________________________________________________________________________________________________________
|
|
--
|
|
1.9.0
|
|
|