coverity#1356337 Resource leak
Change-Id: Id00ee8abd5f22bf0594ad41e3922222872d6c5ca
This commit is contained in:
@@ -259,7 +259,7 @@ public:
|
|||||||
SdDrawDocument* pSourceDoc, bool bMaster, bool bCheckMasters);
|
SdDrawDocument* pSourceDoc, bool bMaster, bool bCheckMasters);
|
||||||
|
|
||||||
SdDrawDocument* OpenBookmarkDoc(const OUString& rBookmarkFile);
|
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,
|
SAL_DLLPRIVATE void InsertBookmark(const std::vector<OUString> &rBookmarkList,
|
||||||
std::vector<OUString> &rExchangeList, bool bLink,
|
std::vector<OUString> &rExchangeList, bool bLink,
|
||||||
|
@@ -197,16 +197,16 @@ static void lcl_IterateBookmarkPages( SdDrawDocument &rDoc, SdDrawDocument* pBoo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Opens a bookmark document
|
// Opens a bookmark document
|
||||||
SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium& rMedium)
|
SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium* pMedium)
|
||||||
{
|
{
|
||||||
bool bOK = true;
|
bool bOK = true;
|
||||||
SdDrawDocument* pBookmarkDoc = nullptr;
|
SdDrawDocument* pBookmarkDoc = nullptr;
|
||||||
OUString aBookmarkName = rMedium.GetName();
|
OUString aBookmarkName = pMedium->GetName();
|
||||||
std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
|
std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
|
||||||
if ( !pFilter )
|
if ( !pFilter )
|
||||||
{
|
{
|
||||||
rMedium.UseInteractionHandler( true );
|
pMedium->UseInteractionHandler( true );
|
||||||
SfxGetpApp()->GetFilterMatcher().GuessFilter( rMedium, pFilter );
|
SfxGetpApp()->GetFilterMatcher().GuessFilter(*pMedium, pFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !pFilter )
|
if ( !pFilter )
|
||||||
@@ -231,7 +231,7 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(SfxMedium& rMedium)
|
|||||||
// Impress
|
// Impress
|
||||||
mxBookmarkDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::STANDARD, true);
|
mxBookmarkDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::STANDARD, true);
|
||||||
|
|
||||||
bOK = mxBookmarkDocShRef->DoLoad(&rMedium);
|
bOK = mxBookmarkDocShRef->DoLoad(pMedium);
|
||||||
if( bOK )
|
if( bOK )
|
||||||
{
|
{
|
||||||
maBookmarkFile = aBookmarkName;
|
maBookmarkFile = aBookmarkName;
|
||||||
@@ -265,8 +265,8 @@ SdDrawDocument* SdDrawDocument::OpenBookmarkDoc(const OUString& rBookmarkFile)
|
|||||||
|
|
||||||
if (!rBookmarkFile.isEmpty() && maBookmarkFile != rBookmarkFile)
|
if (!rBookmarkFile.isEmpty() && maBookmarkFile != rBookmarkFile)
|
||||||
{
|
{
|
||||||
SfxMedium* pMedium = new SfxMedium( rBookmarkFile, StreamMode::READ );
|
std::unique_ptr<SfxMedium> xMedium(new SfxMedium(rBookmarkFile, StreamMode::READ));
|
||||||
pBookmarkDoc = OpenBookmarkDoc(*pMedium);
|
pBookmarkDoc = OpenBookmarkDoc(xMedium.release());
|
||||||
}
|
}
|
||||||
else if (mxBookmarkDocShRef.Is())
|
else if (mxBookmarkDocShRef.Is())
|
||||||
{
|
{
|
||||||
|
@@ -1008,7 +1008,7 @@ SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed)
|
|||||||
// in this mode the document is owned and controlled by the SdDrawDocument
|
// in this mode the document is owned and controlled by the SdDrawDocument
|
||||||
// it can be released by calling the corresponding CloseBookmarkDoc method
|
// it can be released by calling the corresponding CloseBookmarkDoc method
|
||||||
// successful creation of a document makes this the owner of the medium
|
// 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 )
|
if ( !mpBookmarkDoc )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user