]> granicus.if.org Git - python/commitdiff
Add a couple of decrefs to error paths.
authorMichael W. Hudson <mwh@python.net>
Mon, 11 Aug 2003 17:32:02 +0000 (17:32 +0000)
committerMichael W. Hudson <mwh@python.net>
Mon, 11 Aug 2003 17:32:02 +0000 (17:32 +0000)
Now test_descr only appears to leak two references & I think this
are in fact illusory (it's to do with things getting resurrected in
__del__ methods & it's easy to be believe confusion occurs when that
happens <wink>).  Woohoo!

Objects/intobject.c

index a3df3bab61f5a288b44e59c996d6bcdac801e464..b97e2bc631eec236ca317257a246761ce22676e0 100644 (file)
@@ -947,12 +947,14 @@ int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
                if (!PyLong_Check(tmp)) {
                        PyErr_SetString(PyExc_ValueError,
                                        "value must convertable to an int");
+                       Py_DECREF(tmp);
                        return NULL;
                }
                ival = PyLong_AsLong(tmp);
-               if (ival == -1 && PyErr_Occurred())
+               if (ival == -1 && PyErr_Occurred()) {
+                       Py_DECREF(tmp);
                        return NULL;
-
+               }
        } else {
                ival = ((PyIntObject *)tmp)->ob_ival;
        }