plug reference leak

This commit is contained in:
Benjamin Peterson 2011-01-13 04:22:54 +00:00
parent 00fa03900c
commit 547d4859b9
1 changed files with 4 additions and 2 deletions

View File

@ -307,11 +307,13 @@ compute_range_item(rangeobject *r, PyObject *arg)
static PyObject * static PyObject *
range_item(rangeobject *r, Py_ssize_t i) range_item(rangeobject *r, Py_ssize_t i)
{ {
PyObject *arg = PyLong_FromLong(i); PyObject *res, *arg = PyLong_FromLong(i);
if (!arg) { if (!arg) {
return NULL; return NULL;
} }
return compute_range_item(r, arg); res = compute_range_item(r, arg);
Py_DECREF(arg);
return res;
} }
/* Additional helpers, since the standard slice helpers /* Additional helpers, since the standard slice helpers