svx/source/svdraw/svdedtv.cxx | 1 + svx/source/svdraw/svdundo.cxx | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-)
New commits: commit 43644510f29ff15da2fd87c7a6ea654e9f799efc Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Aug 28 14:31:17 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Aug 28 17:21:36 2022 +0200 cid#1500441 silence Resource leak and cid#1500631 Resource leak cid#1500695 Resource leak Change-Id: Idf8aa7b44c6ba3aafcde7b7d3a3522224fe3f865 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138941 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index b019f26ae47a..fbde60ff197f 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -288,6 +288,7 @@ void SdrEditView::DeleteLayer(const OUString& rName) if( bUndo ) { AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, *mpModel)); + // coverity[leaked_storage] - ownership transferred to UndoDeleteLayer rLA.RemoveLayer(nLayerNum).release(); EndUndo(); } diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 792b62b7a76f..9d104230b36e 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -1309,13 +1309,13 @@ SdrUndoLayer::~SdrUndoLayer() } } - void SdrUndoNewLayer::Undo() { DBG_ASSERT(!bItsMine,"SdrUndoNewLayer::Undo(): Layer already belongs to UndoAction."); bItsMine=true; - SdrLayer* pCmpLayer= pLayerAdmin->RemoveLayer(nNum).release(); - DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoNewLayer::Undo(): Removed layer is != pLayer."); + // coverity[leaked_storage] - owned by this SdrUndoNewLayer as pLayer + SdrLayer* pCmpLayer = pLayerAdmin->RemoveLayer(nNum).release(); + assert(pCmpLayer == pLayer && "SdrUndoNewLayer::Undo(): Removed layer is != pLayer."); (void)pCmpLayer; } void SdrUndoNewLayer::Redo() @@ -1342,8 +1342,9 @@ void SdrUndoDelLayer::Redo() { DBG_ASSERT(!bItsMine,"SdrUndoDelLayer::Undo(): Layer already belongs to UndoAction."); bItsMine=true; + // coverity[leaked_storage] - owned by this SdrUndoNewLayer as pLayer SdrLayer* pCmpLayer= pLayerAdmin->RemoveLayer(nNum).release(); - DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoDelLayer::Redo(): Removed layer is != pLayer."); + assert(pCmpLayer == pLayer && "SdrUndoDelLayer::Redo(): Removed layer is != pLayer."); (void)pCmpLayer; } OUString SdrUndoDelLayer::GetComment() const