summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-26 10:27:48 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-06-18 15:06:21 +0200
commite4335f77cffeaa35883b82a00eed1ff8f4665288 (patch)
tree7a87a58b85fd3b6225fcbb97ffcc5fbcee639322
parent32e8b6de30639f14ce47f83828a8f402e04f572a (diff)
coverity#1409895 Resource leak
Change-Id: I1430ac41bf11bf3ae5c4cba3406a24148acd728e Reviewed-on: https://gerrit.libreoffice.org/38918 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-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 );