summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-27 10:11:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-03-27 13:30:40 +0200
commitedfa0562617c1330cc00923a5cf6e5916bacfed0 (patch)
treef397da4f7dbf2e137a73e7df931348867339c104 /sc/source
parent3acc5a2383f5b0458e3caf1505fe6b8ad7dc3fb0 (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 Change-Id: I8aeed6876d80b7ebe4ebb5e2cfd12e00420bd207 Reviewed-on: https://gerrit.libreoffice.org/51932 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
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 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
}