Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak for strings passed to TVP #1339

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,6 @@ static PyObject* execute(Cursor* cur, PyObject* pSql, PyObject* params, bool ski
Py_XDECREF(prevParam->pObject);
newParam.BufferLength = newParam.StrLen_or_Ind;
newParam.StrLen_or_Ind = SQL_DATA_AT_EXEC;
Py_INCREF(cell);
newParam.pObject = cell;
*prevParam = newParam;
if(prevParam->ParameterValuePtr == &newParam.Data)
{
Expand Down
1 change: 1 addition & 0 deletions src/params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1266,6 +1266,7 @@ bool BindParameter(Cursor* cur, Py_ssize_t index, ParamInfo& info)
{
// Bind the TVP's columns --- all need to use DAE
PyObject *param = PySequence_GetItem(row, i);
Py_XDECREF(param);
GetParameterInfo(cur, i, param, info.nested[i], true);
info.nested[i].BufferLength = info.nested[i].StrLen_or_Ind;
info.nested[i].StrLen_or_Ind = SQL_DATA_AT_EXEC;
Expand Down