summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2013-04-14 09:45:16 (GMT)
committerGeorg Brandl <georg@python.org>2013-04-14 09:45:16 (GMT)
commit10bb21e4f964ee35004efbf75ea9ae5c5873af28 (patch)
tree1f836f40ea4e523a475c0931c2b1ca5dcc38bff5 /Doc/c-api
parentba58cbe7541deb963c555af59e433f8046391a54 (diff)
downloadcpython-10bb21e4f964ee35004efbf75ea9ae5c5873af28.zip
cpython-10bb21e4f964ee35004efbf75ea9ae5c5873af28.tar.gz
cpython-10bb21e4f964ee35004efbf75ea9ae5c5873af28.tar.bz2
Fix refcount leak in the reference counting example section (!).
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/intro.rst4
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
index c3a9ed6..6414277 100644
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -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;