Skip to content
Prev Previous commit
Next Next commit
Added error handling for Py_*.
  • Loading branch information
felixxm committed Jan 24, 2024
commit 048a6a20a44a9535aecc626954dbe458158f1247
18 changes: 17 additions & 1 deletion Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -2005,10 +2005,26 @@ pysqlite_connection_iterdump_impl(pysqlite_Connection *self,
}
PyObject *args[2] = {(PyObject *)self, filter};
PyObject *kwnames = PyTuple_New(1);
PyTuple_SET_ITEM(kwnames, 0, PyUnicode_FromString("filter"));
PyObject *py_filter = NULL;

if (!kwnames) {
goto error;
}
py_filter = PyUnicode_FromString("filter");
if (!py_filter) {
goto error;
}
PyTuple_SET_ITEM(kwnames, 0, py_filter);

PyObject *retval = PyObject_Vectorcall(iterdump, args, 1, kwnames);
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
Py_DECREF(iterdump);
return retval;

error:
Py_DECREF(iterdump);
Py_DECREF(args);
Comment thread
felixxm marked this conversation as resolved.
Outdated
Py_XDECREF(kwnames);
return NULL;
}

/*[clinic input]
Expand Down