IBM / node-odbc

ODBC bindings for node
MIT License
146 stars 77 forks source link

Ensure long data column buffers are freed #306

Closed kadler closed 1 year ago

kadler commented 1 year ago

The bind_type of the column stored in the StatementData object was not copied over to the ColumnData object created for each row. This means that the ColumnData destructor will not free the allocated buffer used with SQLGetData.

Additionally, for SQL_C_BINARY columns, the data was never freed either since the destructor only checked for SQL_C_CHAR and SQL_C_WCHAR.

Finally, because long data allocations are created using malloc/realloc, we need to set a flag to use free instead of delete[] in the destructor. On platforms we support, this shouldn't actually make any difference, but it is mandated by the spec and reduces noise in valgrind.

Signed-off-by: Kevin Adler kadler@us.ibm.com Fixes #304

victorshengchen commented 1 year ago

Good. This looks an important fix. Do we have target version/schedule to have this released?