This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new 06c85e19 Correct ODBCAppender prepared statement value buffer
lifetimes (#581)
06c85e19 is described below
commit 06c85e19a0b4adf809d842568219369575cce658
Author: Stephen Webb <[email protected]>
AuthorDate: Tue Jan 27 16:23:35 2026 +1100
Correct ODBCAppender prepared statement value buffer lifetimes (#581)
---
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;