summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-12-08 15:59:53 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-03-27 13:09:58 +0200
commit28632f5c575e1ddc0920041f72686758bf521103 (patch)
tree0cfddcf6b5a3a7471a048dc7fffe3e34fda5e5f8 /sc/source
parentcb717d293f31ac98d2fd214f792ac5c1441aa444 (diff)
ofz#7121 NamedDBs::insert takes ownership of its argument
at one point this was based on std::auto_ptr and didn't free its arg on failure Adapt description to reality Change-Id: I24133fb6c52bd7500037364120cb11d1b1f099c2 (cherry picked from commit f161cdc979587488df83e63002bee7ee15152d42) Change-Id: I8aeed6876d80b7ebe4ebb5e2cfd12e00420bd207 Reviewed-on: https://gerrit.libreoffice.org/51933 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/filter/xml/xmldrani.cxx5
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx1
2 files changed, 1 insertions, 5 deletions
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index c6d1dde218e3..1496c91bfa83 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 02090556c614..d518ff17c03a 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(pUndoColl); // belongs to the document then
}