summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-09-23 08:53:17 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-09-24 11:33:50 +0200
commitfd5b497cf2a9d0a276c83b702e1499513bb9fab9 (patch)
treec84fe0074cc28b8bf9737826b95f3a9614095b51 /dbaccess
parent7f1ded9d814f6558ae9b2e6e85063c355950200e (diff)
memory leak on loading dbase files
see on loading qadevOOo/testdocs/BasicDB/DBTest.dbf a problem apparently since... commit a245e5c60fac58889738a9705225c6378b35eef4 Date: Tue May 8 12:42:55 2018 +0200 loplugin:useuniqueptr in ORowSet OTableContainer inherits from OCollection which has a unique and nonstandard acquire/release which forwards to a parent cppu::OWeakObject. So when it would appear to a casual observer, who assumes that it has an internal refcount, that its refcount would drop to zero and then get auto-deleted, nothing of the kind occurs. Change-Id: Ib104415ccc13c6ed9c06f975857fcd4413e2e05d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122519 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 85ef14318897f6e32c4987ab9d76c38a9752da24) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122440 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/RowSet.cxx4
-rw-r--r--dbaccess/source/core/api/RowSet.hxx2
2 files changed, 3 insertions, 3 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index f7deaa0c1d5e..3eee1c296060 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -2231,7 +2231,7 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw()
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend);
+ m_xTables.reset(new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend));
xTables = m_xTables.get();
Sequence<OUString> aTableFilter { "%" };
m_xTables->construct(aTableFilter,Sequence< OUString>());
@@ -2254,7 +2254,7 @@ void ORowSet::impl_resetTables_nothrow()
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xTables.clear();
+ m_xTables.reset();
}
void ORowSet::impl_initComposer_throw( OUString& _out_rCommandToExecute )
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index a7d06a7a6567..33a1aceaa4c5 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -100,7 +100,7 @@ namespace dbaccess
::dbtools::WarningsContainer m_aWarnings;
- rtl::Reference<OTableContainer> m_xTables;
+ std::unique_ptr<OTableContainer> m_xTables;
OUString m_aCommand;
OUString m_aDataSourceName;