summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-11-25 15:20:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-11-25 15:45:58 +0000
commit3c100a9c61ac984983d077e294c32b388d70d892 (patch)
tree59208abf4ce0a7e688fb0b52df4c77443a9d7e5a /sd
parent8244fc2655e37f178f32d63133edf08def8f62c8 (diff)
coverity#1340228 try and silence Resource leak
Change-Id: I654fc22bbab2301e74cf200577f934e56f77fb58
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/dlg/navigatr.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 0617324a8348..a72a71f0ed45 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -621,15 +621,15 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName)
{
// The medium may be opened with READ/WRITE. Therefore, we first
// check if it contains a Storage.
- SfxMedium* pMedium = new SfxMedium( aFileName,
- StreamMode::READ | StreamMode::NOCREATE);
+ std::unique_ptr<SfxMedium> xMedium(new SfxMedium(aFileName,
+ StreamMode::READ | StreamMode::NOCREATE));
- if (pMedium->IsStorage())
+ if (xMedium->IsStorage())
{
// Now depending on mode:
// maTlbObjects->SetSelectionMode(MULTIPLE_SELECTION);
- // handover of ownership of pMedium;
- SdDrawDocument* pDropDoc = maTlbObjects->GetBookmarkDoc(pMedium);
+ // handover of ownership of xMedium;
+ SdDrawDocument* pDropDoc = maTlbObjects->GetBookmarkDoc(xMedium.release());
if (pDropDoc)
{
@@ -646,7 +646,6 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName)
}
else
{
- delete pMedium;
return false;
}
}