Fix memory leak

Change-Id: I70522657f968ed4f84e9447dd999d8be746fc973
This commit is contained in:
Stephan Bergmann
2014-05-30 15:48:49 +02:00
parent 63405c0500
commit c9f5e9b709
2 changed files with 3 additions and 6 deletions

View File

@@ -103,7 +103,6 @@ OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< conne
,m_nParamIndex(0) ,m_nParamIndex(0)
,m_bIsAlwaysFalseQuery(false) ,m_bIsAlwaysFalseQuery(false)
,m_pKeySet(NULL) ,m_pKeySet(NULL)
,m_pSortIndex(NULL)
,m_nNewRow(0) ,m_nNewRow(0)
,m_nUpdatedRow(0) ,m_nUpdatedRow(0)
,m_RowStates(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!!"); 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()); OSL_TRACE("OrderbyColumnNumber->size() = %zu",m_aOrderbyColumnNumber.size());
#if OSL_DEBUG_LEVEL > 0 #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)); 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<sal_Int32>(m_pKeySet->get().size()); m_CurrentRowCount = static_cast<sal_Int32>(m_pKeySet->get().size());
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ ) for( OKeySet::Vector::size_type i = 0; i < m_pKeySet->get().size(); i++ )
OSL_TRACE("Sorted: %d -> %d", i, (m_pKeySet->get())[i] ); OSL_TRACE("Sorted: %d -> %d", i, (m_pKeySet->get())[i] );
#endif #endif
m_pSortIndex = NULL;
beforeFirst(); // Go back to start beforeFirst(); // Go back to start
} }
else //we always need m_pKeySet now else //we always need m_pKeySet now

View File

@@ -237,7 +237,6 @@ protected:
sal_Int32 m_nParamIndex; sal_Int32 m_nParamIndex;
bool m_bIsAlwaysFalseQuery; bool m_bIsAlwaysFalseQuery;
::rtl::Reference<OKeySet> m_pKeySet; ::rtl::Reference<OKeySet> m_pKeySet;
OSortIndex* m_pSortIndex;
sal_Int32 m_nNewRow; //inserted row sal_Int32 m_nNewRow; //inserted row
sal_Int32 m_nUpdatedRow; //updated row sal_Int32 m_nUpdatedRow; //updated row
sal_Int32 m_RowStates; sal_Int32 m_RowStates;