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

Conversation

mavxg
Copy link
Contributor

@mavxg mavxg commented Mar 29, 2024

Fixes #1338

@gordthompson
Copy link
Collaborator

Looks okay to me, and it does appear to plug the leak. Thanks!

Should we include the Py_XDECREF call from here as well?

(My C++ skills are way too rusty to accept this PR myself.)

@mavxg
Copy link
Contributor Author

mavxg commented Mar 29, 2024

Yes. It fixes another leak for the first row/tuple in the sequence. For TVP, BindParameters is getting just the first row (not sure what the reason behind the PySequence_Size(info.pObject) - info.ColumnSize to get the first item in the sequence). PyObject *param = PySequence_GetItem(row, i); will increase the ref count of the items in the first tuple in the sequence and the Py_XDECREF would then decrease it again.

@mkleehammer mkleehammer merged commit 7a710e7 into mkleehammer:master Apr 16, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory leak when passing strings within table value parameter to stored proc
3 participants