From 547d4859b9cb7593fdd7e9828b18872cc4282ed6 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 13 Jan 2011 04:22:54 +0000 Subject: [PATCH] plug reference leak --- Objects/rangeobject.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c index ee42ba9c9b5..979a62afdb1 100644 --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -307,11 +307,13 @@ compute_range_item(rangeobject *r, PyObject *arg) static PyObject * range_item(rangeobject *r, Py_ssize_t i) { - PyObject *arg = PyLong_FromLong(i); + PyObject *res, *arg = PyLong_FromLong(i); if (!arg) { return NULL; } - return compute_range_item(r, arg); + res = compute_range_item(r, arg); + Py_DECREF(arg); + return res; } /* Additional helpers, since the standard slice helpers