commit | 10bb21e4f964ee35004efbf75ea9ae5c5873af28 | [log] [tgz] |
---|---|---|
author | Georg Brandl <georg@python.org> | Sun Apr 14 11:45:16 2013 +0200 |
committer | Georg Brandl <georg@python.org> | Sun Apr 14 11:45:16 2013 +0200 |
tree | 1f836f40ea4e523a475c0931c2b1ca5dcc38bff5 | |
parent | ba58cbe7541deb963c555af59e433f8046391a54 [diff] |
Fix refcount leak in the reference counting example section (!).
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 @@ 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;