coverity#1340228 try and silence Resource leak

Change-Id: I654fc22bbab2301e74cf200577f934e56f77fb58
This commit is contained in:
Caolán McNamara
2015-11-25 15:20:06 +00:00
parent 8244fc2655
commit 3c100a9c61

View File

@@ -621,15 +621,15 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName)
{ {
// The medium may be opened with READ/WRITE. Therefore, we first // The medium may be opened with READ/WRITE. Therefore, we first
// check if it contains a Storage. // check if it contains a Storage.
SfxMedium* pMedium = new SfxMedium( aFileName, std::unique_ptr<SfxMedium> xMedium(new SfxMedium(aFileName,
StreamMode::READ | StreamMode::NOCREATE); StreamMode::READ | StreamMode::NOCREATE));
if (pMedium->IsStorage()) if (xMedium->IsStorage())
{ {
// Now depending on mode: // Now depending on mode:
// maTlbObjects->SetSelectionMode(MULTIPLE_SELECTION); // maTlbObjects->SetSelectionMode(MULTIPLE_SELECTION);
// handover of ownership of pMedium; // handover of ownership of xMedium;
SdDrawDocument* pDropDoc = maTlbObjects->GetBookmarkDoc(pMedium); SdDrawDocument* pDropDoc = maTlbObjects->GetBookmarkDoc(xMedium.release());
if (pDropDoc) if (pDropDoc)
{ {
@@ -646,7 +646,6 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName)
} }
else else
{ {
delete pMedium;
return false; return false;
} }
} }