Skip to content

Commit 048a6a2

Browse files
committed
Added error handling for Py_*.
1 parent e181dcb commit 048a6a2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Modules/_sqlite/connection.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,10 +2005,26 @@ pysqlite_connection_iterdump_impl(pysqlite_Connection *self,
20052005
}
20062006
PyObject *args[2] = {(PyObject *)self, filter};
20072007
PyObject *kwnames = PyTuple_New(1);
2008-
PyTuple_SET_ITEM(kwnames, 0, PyUnicode_FromString("filter"));
2008+
PyObject *py_filter = NULL;
2009+
2010+
if (!kwnames) {
2011+
goto error;
2012+
}
2013+
py_filter = PyUnicode_FromString("filter");
2014+
if (!py_filter) {
2015+
goto error;
2016+
}
2017+
PyTuple_SET_ITEM(kwnames, 0, py_filter);
2018+
20092019
PyObject *retval = PyObject_Vectorcall(iterdump, args, 1, kwnames);
20102020
Py_DECREF(iterdump);
20112021
return retval;
2022+
2023+
error:
2024+
Py_DECREF(iterdump);
2025+
Py_DECREF(args);
2026+
Py_XDECREF(kwnames);
2027+
return NULL;
20122028
}
20132029

20142030
/*[clinic input]

0 commit comments

Comments
 (0)