summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-03-16 09:19:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-03-16 09:29:52 +0000
commit5873b3643d5b0b71a1de3df7fea4534a1fa6ebcd (patch)
tree8054aee7afa4fac6b516b3301224adcc3fa8233d /sd
parent95548f1615e506ed70d304d2d540430a30b2f7b5 (diff)
coverity#1356337 Resource leak
Change-Id: Id00ee8abd5f22bf0594ad41e3922222872d6c5ca
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/drawdoc.hxx2
-rw-r--r--sd/source/core/drawdoc3.cxx16
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx2
3 files changed, 10 insertions, 10 deletions
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index f3a599a66c56..af5798889d37 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -259,7 +259,7 @@ public:
SdDrawDocument* pSourceDoc, bool bMaster, bool bCheckMasters);
SdDrawDocument* OpenBookmarkDoc(const OUString& rBookmarkFile);
- SAL_DLLPRIVATE SdDrawDocument* OpenBookmarkDoc(SfxMedium& rMedium);
+ SAL_DLLPRIVATE SdDrawDocument* OpenBookmarkDoc(SfxMedium* pMedium);
SAL_DLLPRIVATE void InsertBookmark(const std::vector<OUString> &rBookmarkList,
std::vector<OUString> &rExchangeList, bool bLink,
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 176cc3257584..f1559fae0461 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -197,16 +197,16 @@ static void lcl_IterateBookmarkPages( SdDrawDocument &rDoc, SdDrawDocument* pBoo
}
// Opens a bookmark document
-SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium& rMedium)
+SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium* pMedium)
{
bool bOK = true;
SdDrawDocument* pBookmarkDoc = nullptr;
- OUString aBookmarkName = rMedium.GetName();
- std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
+ OUString aBookmarkName = pMedium->GetName();
+ std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
if ( !pFilter )
{
- rMedium.UseInteractionHandler( true );
- SfxGetpApp()->GetFilterMatcher().GuessFilter( rMedium, pFilter );
+ pMedium->UseInteractionHandler( true );
+ SfxGetpApp()->GetFilterMatcher().GuessFilter(*pMedium, pFilter);
}
if ( !pFilter )
@@ -231,7 +231,7 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium& rMedium)
// Impress
mxBookmarkDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::STANDARD, true);
- bOK = mxBookmarkDocShRef->DoLoad(&rMedium);
+ bOK = mxBookmarkDocShRef->DoLoad(pMedium);
if( bOK )
{
maBookmarkFile = aBookmarkName;
@@ -265,8 +265,8 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(const OUString& rBookmarkFile)
if (!rBookmarkFile.isEmpty() && maBookmarkFile != rBookmarkFile)
{
- SfxMedium* pMedium = new SfxMedium( rBookmarkFile, StreamMode::READ );
- pBookmarkDoc = OpenBookmarkDoc(*pMedium);
+ std::unique_ptr<SfxMedium> xMedium(new SfxMedium(rBookmarkFile, StreamMode::READ));
+ pBookmarkDoc = OpenBookmarkDoc(xMedium.release());
}
else if (mxBookmarkDocShRef.Is())
{
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 27979f8dfefd..ccd9063ab755 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1008,7 +1008,7 @@ SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed)
// in this mode the document is owned and controlled by the SdDrawDocument
// it can be released by calling the corresponding CloseBookmarkDoc method
// successful creation of a document makes this the owner of the medium
- mpBookmarkDoc = const_cast<SdDrawDocument*>(mpDoc)->OpenBookmarkDoc(*mpMedium);
+ mpBookmarkDoc = const_cast<SdDrawDocument*>(mpDoc)->OpenBookmarkDoc(mpMedium);
if ( !mpBookmarkDoc )
{