This is an automated email from the ASF dual-hosted git repository. swebb2066 pushed a commit to branch fix_odbc_prepared_statement_buffer_lifetimes in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
commit 281d4adba3ab6c0f08afe261620f203f52115dca Author: Stephen Webb <[email protected]> AuthorDate: Mon Jan 26 14:48:52 2026 +1100 Correct ODBCAppender prepared statement value buffer lifetimes --- src/main/cpp/odbcappender.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/cpp/odbcappender.cpp b/src/main/cpp/odbcappender.cpp index 24a2c528..b66d18d7 100644 --- a/src/main/cpp/odbcappender.cpp +++ b/src/main/cpp/odbcappender.cpp @@ -458,14 +458,14 @@ void ODBCAppender::ODBCAppenderPriv::setPreparedStatement(SQLHDBC con, Pool& p) item.paramType = SQL_C_CHAR; item.paramMaxCharCount = targetMaxCharCount; item.paramValueSize = (SQLINTEGER)(item.paramMaxCharCount) * sizeof(char) + sizeof(char); - item.paramValue = (SQLPOINTER)p.palloc(item.paramValueSize + sizeof(char)); + item.paramValue = (SQLPOINTER)this->pool.palloc(item.paramValueSize + sizeof(char)); } else if (SQL_WCHAR == targetType || SQL_WVARCHAR == targetType || SQL_WLONGVARCHAR == targetType) { item.paramType = SQL_C_WCHAR; item.paramMaxCharCount = targetMaxCharCount; item.paramValueSize = (SQLINTEGER)(targetMaxCharCount) * sizeof(wchar_t) + sizeof(wchar_t); - item.paramValue = (SQLPOINTER)p.palloc(item.paramValueSize + sizeof(wchar_t)); + item.paramValue = (SQLPOINTER)this->pool.palloc(item.paramValueSize + sizeof(wchar_t)); } else if (SQL_TYPE_TIMESTAMP == targetType || SQL_TYPE_DATE == targetType || SQL_TYPE_TIME == targetType || SQL_DATETIME == targetType) @@ -473,7 +473,7 @@ void ODBCAppender::ODBCAppenderPriv::setPreparedStatement(SQLHDBC con, Pool& p) item.paramType = SQL_C_TYPE_TIMESTAMP; item.paramMaxCharCount = (0 <= decimalDigits) ? decimalDigits : 6; item.paramValueSize = sizeof(SQL_TIMESTAMP_STRUCT); - item.paramValue = (SQLPOINTER)p.palloc(item.paramValueSize); + item.paramValue = (SQLPOINTER)this->pool.palloc(item.paramValueSize); } else { @@ -490,11 +490,11 @@ void ODBCAppender::ODBCAppenderPriv::setPreparedStatement(SQLHDBC con, Pool& p) #if LOG4CXX_LOGCHAR_IS_UTF8 item.paramType = SQL_C_CHAR; item.paramValueSize = (SQLINTEGER)(item.paramMaxCharCount) * sizeof(char); - item.paramValue = (SQLPOINTER)p.palloc(item.paramValueSize + sizeof(char)); + item.paramValue = (SQLPOINTER)this->pool.palloc(item.paramValueSize + sizeof(char)); #else item.paramType = SQL_C_WCHAR; item.paramValueSize = (SQLINTEGER)(item.paramMaxCharCount) * sizeof(wchar_t); - item.paramValue = (SQLPOINTER)p.palloc(item.paramValueSize + sizeof(wchar_t)); + item.paramValue = (SQLPOINTER)this->pool.palloc(item.paramValueSize + sizeof(wchar_t)); #endif } item.strLen_or_Ind = SQL_NTS;
