From 8e1ddbd592c3aaf02a58789771f891c0101c6e05 Mon Sep 17 00:00:00 2001 From: Xiang Zhang Date: Mon, 17 Apr 2017 00:54:21 +0800 Subject: [PATCH] fix a refleak in slot_sq_length (#1162) --- Objects/typeobject.c | 1 + 1 file changed, 1 insertion(+) 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;