diff options
author | Andy Shaw <andy.shaw@digia.com> | 2014-05-26 13:20:40 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-27 19:23:58 +0200 |
commit | d153e4628e7643cf02b795f68f739c4bced15389 (patch) | |
tree | 6eeb22a82bbd540250fd882b0dc3df2fe91d2c75 /src/sql/drivers/odbc/qsql_odbc.cpp | |
parent | d0c38291eb8c58b85c5df21afe6c3b729b3cb492 (diff) |
Initialize the count variable used in SQLNumResultCols to 0
If the call to SQLNumResultCols fails for whatever reason then it will
not be correctly caught since the count might be higher than 0 since it is
uninitalized. This ensures that if it fails then it does not try to act as
if it succeeded.
Task-number: QTBUG-39137
Change-Id: Ifae8c1f7fac8416643f2317747f87295642a7935
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'src/sql/drivers/odbc/qsql_odbc.cpp')
-rw-r--r-- | src/sql/drivers/odbc/qsql_odbc.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index c950d2c2ef..23eff8dbe3 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -963,7 +963,7 @@ bool QODBCResult::reset (const QString& query) if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) QSqlResult::setForwardOnly(isScrollable==SQL_NONSCROLLABLE); - SQLSMALLINT count; + SQLSMALLINT count = 0; SQLNumResultCols(d->hStmt, &count); if (count) { setSelect(true); @@ -1591,7 +1591,7 @@ bool QODBCResult::exec() if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) QSqlResult::setForwardOnly(isScrollable==SQL_NONSCROLLABLE); - SQLSMALLINT count; + SQLSMALLINT count = 0; SQLNumResultCols(d->hStmt, &count); if (count) { setSelect(true); @@ -1723,7 +1723,7 @@ bool QODBCResult::nextResult() } } - SQLSMALLINT count; + SQLSMALLINT count = 0; SQLNumResultCols(d->hStmt, &count); if (count) { setSelect(true); |