[Libreoffice-commits] .: connectivity/source

Noel Power noelp at kemper.freedesktop.org
Fri Oct 28 02:15:33 PDT 2011


 connectivity/source/drivers/odbcbase/OConnection.cxx |   20 +++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 9b58d9353073c6535da0529cd9a48e435f043fa8
Author: Terrence Enger <tenger at iseries-guru.com>
Date:   Thu Oct 27 16:37:50 2011 -0400

    leaking connection handle
    
    call SQLDisconnect;
    check returns from SQLDisconnect and SQLFreeHandle

diff --git a/connectivity/source/drivers/odbcbase/OConnection.cxx b/connectivity/source/drivers/odbcbase/OConnection.cxx
index 891eabc..03bc39b 100644
--- a/connectivity/source/drivers/odbcbase/OConnection.cxx
+++ b/connectivity/source/drivers/odbcbase/OConnection.cxx
@@ -78,8 +78,24 @@ OConnection::~OConnection()
         close();
 
     if ( SQL_NULL_HANDLE != m_aConnectionHandle )
-        N3SQLFreeHandle( SQL_HANDLE_DBC, m_aConnectionHandle );
-    m_aConnectionHandle = SQL_NULL_HANDLE;
+    {
+        SQLRETURN rc;
+
+        rc = N3SQLDisconnect( m_aConnectionHandle );
+        if ( SQL_SUCCESS           != rc &&
+             SQL_SUCCESS_WITH_INFO != rc )
+            OSL_TRACE( "Failure from SQLDisconnect, %s:%i"
+                     , __FILE__, __LINE__
+                     );
+
+        rc = N3SQLFreeHandle( SQL_HANDLE_DBC, m_aConnectionHandle );
+        if ( SQL_SUCCESS != rc )
+            OSL_TRACE( "Failure from SQLFreeHandle for connection, %s:%i"
+                     , __FILE__, __LINE__
+                     );
+
+        m_aConnectionHandle = SQL_NULL_HANDLE;
+    }
 
     m_pDriver->release();
     m_pDriver = NULL;


More information about the Libreoffice-commits mailing list