From c9f5e9b70968ab3f6990a47f5c98e55bcc87650d Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 30 May 2014 15:48:49 +0200 Subject: [PATCH] Fix memory leak Change-Id: I70522657f968ed4f84e9447dd999d8be746fc973 --- connectivity/source/drivers/mork/MResultSet.cxx | 8 +++----- connectivity/source/drivers/mork/MResultSet.hxx | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/connectivity/source/drivers/mork/MResultSet.cxx b/connectivity/source/drivers/mork/MResultSet.cxx index d88f7845774f..95aa7d56a1d0 100644 --- a/connectivity/source/drivers/mork/MResultSet.cxx +++ b/connectivity/source/drivers/mork/MResultSet.cxx @@ -103,7 +103,6 @@ OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< conne ,m_nParamIndex(0) ,m_bIsAlwaysFalseQuery(false) ,m_pKeySet(NULL) - ,m_pSortIndex(NULL) ,m_nNewRow(0) ,m_nUpdatedRow(0) ,m_RowStates(0) @@ -1266,7 +1265,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep OSL_ENSURE( m_aQueryHelper.queryComplete(), "Query not complete!!"); - m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending); + OSortIndex aSortIndex(eKeyType,m_aOrderbyAscending); OSL_TRACE("OrderbyColumnNumber->size() = %zu",m_aOrderbyColumnNumber.size()); #if OSL_DEBUG_LEVEL > 0 @@ -1287,17 +1286,16 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep pKeyValue->pushKey(new ORowSetValueDecorator(value)); } - m_pSortIndex->AddKeyValue( pKeyValue ); + aSortIndex.AddKeyValue( pKeyValue ); } - m_pKeySet = m_pSortIndex->CreateKeySet(); + m_pKeySet = aSortIndex.CreateKeySet(); m_CurrentRowCount = static_cast(m_pKeySet->get().size()); #if OSL_DEBUG_LEVEL > 0 for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ ) OSL_TRACE("Sorted: %d -> %d", i, (m_pKeySet->get())[i] ); #endif - m_pSortIndex = NULL; beforeFirst(); // Go back to start } else //we always need m_pKeySet now diff --git a/connectivity/source/drivers/mork/MResultSet.hxx b/connectivity/source/drivers/mork/MResultSet.hxx index f6bb8dca0703..1126ef7d73e1 100644 --- a/connectivity/source/drivers/mork/MResultSet.hxx +++ b/connectivity/source/drivers/mork/MResultSet.hxx @@ -237,7 +237,6 @@ protected: sal_Int32 m_nParamIndex; bool m_bIsAlwaysFalseQuery; ::rtl::Reference m_pKeySet; - OSortIndex* m_pSortIndex; sal_Int32 m_nNewRow; //inserted row sal_Int32 m_nUpdatedRow; //updated row sal_Int32 m_RowStates;