summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-26 10:27:48 +0100
committerAndras Timar <andras.timar@collabora.com>2017-06-06 14:05:37 +0200
commit43793cdce361004b11d2acde4470350afb9d26f7 (patch)
treef44fd9692343665300707ce7d901a9a195f6b81e
parent48c9369f68560dd8865da40ecd9227dc2240e28d (diff)
coverity#1409895 Resource leak
Change-Id: I1430ac41bf11bf3ae5c4cba3406a24148acd728e (cherry picked from commit e805881d74392969746d34756b035850c67883e6)
-rw-r--r--sw/source/uibase/dialog/watermarkdialog.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/sw/source/uibase/dialog/watermarkdialog.cxx b/sw/source/uibase/dialog/watermarkdialog.cxx
index 6b993d22caf1..29131215a72b 100644
--- a/sw/source/uibase/dialog/watermarkdialog.cxx
+++ b/sw/source/uibase/dialog/watermarkdialog.cxx
@@ -57,12 +57,16 @@ void SwWatermarkDialog::InitFields()
SfxObjectShell* pDocSh = SfxObjectShell::Current();
const SfxPoolItem* pFontItem;
const FontList* pFontList = nullptr;
+ std::unique_ptr<FontList> xFontList;
if ( pDocSh && ( ( pFontItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ) ) != nullptr ) )
pFontList = static_cast<const SvxFontListItem*>( pFontItem )->GetFontList();
- if(!pFontList)
- pFontList = new FontList(Application::GetDefaultDevice(), nullptr);
+ if (!pFontList)
+ {
+ xFontList.reset(new FontList(Application::GetDefaultDevice(), nullptr));
+ pFontList = xFontList.get();
+ }
m_pFont->Fill( pFontList );