From 1509316a37fb2d365230d020d1dfc251c830fd56 Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Thu, 26 Apr 2012 13:17:40 +0300 Subject: Fix memory leaks in 64-bits ODBC driver On 64-bits Windows system, integers and longs are still 4 bytes values. Several functions that were previously defined with SQLINTEGER and SQLUINTEGER parameters have been changed where appropiate to use new SQLLEN and SQLULEN typedefs. SQLGetStmtAttr() is one of these functions. This fix replaces SQLINTEGER with SQLULEN in appropriate functions to avoid memory leaks. Task-number: QTBUG-25256 Change-Id: I744927f42b8578ece60815df360e3b337ebf452a Reviewed-by: Andy Shaw Reviewed-by: Mark Brand --- src/sql/drivers/odbc/qsql_odbc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index f503f64cdf..04bc0cc894 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -962,7 +962,8 @@ bool QODBCResult::reset (const QString& query) return true; } - SQLINTEGER isScrollable, bufferLength; + SQLINTEGER bufferLength; + SQLULEN isScrollable; r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength); if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) QSqlResult::setForwardOnly(isScrollable==SQL_NONSCROLLABLE); @@ -1584,7 +1585,8 @@ bool QODBCResult::exec() return false; } - SQLINTEGER isScrollable, bufferLength; + SQLINTEGER bufferLength; + SQLULEN isScrollable; r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength); if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) QSqlResult::setForwardOnly(isScrollable==SQL_NONSCROLLABLE); -- cgit v1.2.3