From: Xiang Zhang Date: Sun, 16 Apr 2017 16:54:21 +0000 (+0800) Subject: fix a refleak in slot_sq_length (#1162) X-Git-Tag: v3.7.0a1~953 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e1ddbd592c3aaf02a58789771f891c0101c6e05;p=thirdparty%2FPython%2Fcpython.git fix a refleak in slot_sq_length (#1162) --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 89fe82c7c39a..9eb725f062ba 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;