aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang Zhang <angwerzx@126.com>2017-04-17 00:54:21 +0800
committerGitHub <noreply@github.com>2017-04-17 00:54:21 +0800
commit8e1ddbd592c3aaf02a58789771f891c0101c6e05 (patch)
tree38ec8af11170276a355811e10d3dbca65228570a /Objects/typeobject.c
parentbpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051) (diff)
downloadcpython-8e1ddbd592c3aaf02a58789771f891c0101c6e05.tar.gz
cpython-8e1ddbd592c3aaf02a58789771f891c0101c6e05.tar.bz2
cpython-8e1ddbd592c3aaf02a58789771f891c0101c6e05.zip
fix a refleak in slot_sq_length (#1162)
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 89fe82c7c39..9eb725f062b 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5931,6 +5931,7 @@ slot_sq_length(PyObject *self)
assert(PyLong_Check(res));
if (Py_SIZE(res) < 0) {
+ Py_DECREF(res);
PyErr_SetString(PyExc_ValueError,
"__len__() should return >= 0");
return -1;