From edfa0562617c1330cc00923a5cf6e5916bacfed0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 27 Mar 2018 10:11:51 +0100 Subject: ofz#7121 NamedDBs::insert takes ownership of its argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit at one point this was based on std::auto_ptr and didn't free its arg on failure Change-Id: I8aeed6876d80b7ebe4ebb5e2cfd12e00420bd207 Reviewed-on: https://gerrit.libreoffice.org/51932 Reviewed-by: Stephan Bergmann Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/source/filter/xml/xmldrani.cxx | 5 +---- sc/source/ui/docshell/dbdocfun.cxx | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'sc/source') diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index 9e88a8943a95..721f7f946a8f 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -444,10 +444,7 @@ void SAL_CALL ScXMLDatabaseRangeContext::endFastElement( sal_Int32 /*nElement*/ if (pData.get()) { setAutoFilterFlags(*pDoc, *pData); - if (pDoc->GetDBCollection()->getNamedDBs().insert(pData.get())) - { - pData.release(); - } + pDoc->GetDBCollection()->getNamedDBs().insert(pData.release()); } } } diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 3a409e774d64..3a8a5d28de06 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -170,7 +170,6 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew ) bool bInserted = rDBs.insert(pNewData); if (!bInserted) // error -> restore old state { - delete pNewData; rDoc.SetDBCollection(std::move(pUndoColl)); // belongs to the document then } -- cgit v1.2.3