summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-01 16:42:49 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-01 16:42:49 (GMT)
commit261116234504e5a250fcb3df704b3438ebc46531 (patch)
treea5b40ffe7a0ca34f4ecf888d0b0c8bcdcb50a337 /Objects
parent73921b0eecb55fe914b60d028cbfefc5c50a52ff (diff)
downloadcpython-261116234504e5a250fcb3df704b3438ebc46531.zip
cpython-261116234504e5a250fcb3df704b3438ebc46531.tar.gz
cpython-261116234504e5a250fcb3df704b3438ebc46531.tar.bz2
slot_sq_length(): squash a leak.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 7a79bcb..ec36bfd 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2729,10 +2729,13 @@ slot_sq_length(PyObject *self)
{
static PyObject *len_str;
PyObject *res = call_method(self, "__len__", &len_str, "()");
+ int len;
if (res == NULL)
return -1;
- return (int)PyInt_AsLong(res);
+ len = (int)PyInt_AsLong(res);
+ Py_DECREF(res);
+ return len;
}
SLOT1(slot_sq_concat, "__add__", PyObject *, "O")