summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-19 21:37:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-20 21:17:01 +0200
commitca11699dbb5c721d527d68e4b68b4eac0d1a7a74 (patch)
tree8e3c67ae6b881928af85da468a1dab7547e53772 /sd
parentd437650712ff05475e1f3e8b2b4dd8fc47b1d8aa (diff)
coverity#1435678 Resource leak
Change-Id: I994508d0d88fa6727c49d568956887ca1d22ce7e Reviewed-on: https://gerrit.libreoffice.org/54588 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/view/viewshe2.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 6c1ad846131c..2b45314c419a 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -478,8 +478,13 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
return;
}
- SdUndoGroup* pUndoGroup(new SdUndoGroup(GetDoc()));
- pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
+ SdUndoGroup* pUndoGroup(nullptr);
+ SfxViewShell* pViewShell(GetViewShell());
+ if (pViewShell)
+ {
+ pUndoGroup = new SdUndoGroup(GetDoc());
+ pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
+ }
Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_START));
// use Model-based method at SdDrawDocument
@@ -503,9 +508,7 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, const Size& rNewSize,
}
// handed over undo group to undo manager
- SfxViewShell* pViewShell(GetViewShell());
-
- if(nullptr != pViewShell)
+ if (pViewShell)
{
pViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager()->AddUndoAction(pUndoGroup);
}