Commit 10bb21e4 authored by Georg Brandl's avatar Georg Brandl

Fix refcount leak in the reference counting example section (!).

parent ba58cbe7
......@@ -255,8 +255,10 @@ sets all items of a list (actually, any mutable sequence) to a given item::
PyObject *index = PyInt_FromLong(i);
if (!index)
return -1;
if (PyObject_SetItem(target, index, item) < 0)
if (PyObject_SetItem(target, index, item) < 0) {
Py_DECREF(index);
return -1;
}
Py_DECREF(index);
}
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment