[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/source
Caolán McNamara
caolanm at redhat.com
Sun Jun 18 13:06:47 UTC 2017
sw/source/uibase/dialog/watermarkdialog.cxx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
New commits:
commit e4335f77cffeaa35883b82a00eed1ff8f4665288
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri May 26 10:27:48 2017 +0100
coverity#1409895 Resource leak
Change-Id: I1430ac41bf11bf3ae5c4cba3406a24148acd728e
Reviewed-on: https://gerrit.libreoffice.org/38918
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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 );
More information about the Libreoffice-commits
mailing list