Skip to content

Commit

Permalink
Fix leak of parameter objects.
Browse files Browse the repository at this point in the history
Parameter object references were incremented, causing them to live forever.
  • Loading branch information
mkleehammer committed Mar 15, 2017
1 parent 13cf350 commit 2059d09
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,7 @@ bool PrepareAndBind(Cursor* cur, PyObject* pSql, PyObject* original_params, bool

for (Py_ssize_t i = 0; i < cParams; i++)
{
// PySequence_GetItem returns a *new* reference, which GetParameterInfo will take ownership of. It is stored
// in paramInfos and will be released in FreeInfos (which is always eventually called).

PyObject* param = PySequence_GetItem(original_params, i + params_offset);
Object param(PySequence_GetItem(original_params, i + params_offset));
if (!GetParameterInfo(cur, i, param, cur->paramInfos[i]))
{
FreeInfos(cur->paramInfos, cParams);
Expand Down

0 comments on commit 2059d09

Please sign in to comment.