From 97cbd9f03dee5117c8ca09ac0c3ac5b3fccf7825 Mon Sep 17 00:00:00 2001 From: Jan Viktorin Date: Thu, 10 Nov 2016 17:34:05 +0100 Subject: [PATCH] ODBC: fix uninitialized variable This prevents valgrind reports like: ==18426== Conditional jump or move depends on uninitialised value(s) ==18426== at 0x6423EB5: Poco::Data::StatementImpl::execute(bool const&) (in /usr/lib/libPocoDatad.so.46) ==18426== by 0x641DB5F: Poco::Data::Statement::execute(bool) (in /usr/lib/libPocoDatad.so.46) ==18426== by 0x632A0C: Poco::Data::Keywords::now(Poco::Data::Statement&) (Statement.h:443) ==18426== by 0x641C8E5: Poco::Data::Statement::operator,(void (*)(Poco::Data::Statement&)) (in /usr/lib/libPocoDatad.so.46) ... ==18426== Uninitialised value was created by a stack allocation ==18426== at 0x6A1A170: Poco::Data::ODBC::ODBCStatementImpl::affectedRowCount() const (in /usr/lib/libPocoDataODBCd.so.46) Signed-off-by: Jan Viktorin --- Data/ODBC/src/ODBCStatementImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/ODBC/src/ODBCStatementImpl.cpp b/Data/ODBC/src/ODBCStatementImpl.cpp index 564cfa80e..1e27c281a 100644 --- a/Data/ODBC/src/ODBCStatementImpl.cpp +++ b/Data/ODBC/src/ODBCStatementImpl.cpp @@ -448,7 +448,7 @@ int ODBCStatementImpl::affectedRowCount() const { if (0 == _affectedRowCount) { - SQLLEN rows; + SQLLEN rows = 0; if (!Utility::isError(SQLRowCount(_stmt, &rows))) _affectedRowCount = static_cast(rows); }