]> granicus.if.org Git - python/commitdiff
builtin_complex(): Nailed memory leak. This one's in the instance
authorBarry Warsaw <barry@python.org>
Wed, 27 Jan 1999 23:13:59 +0000 (23:13 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 27 Jan 1999 23:13:59 +0000 (23:13 +0000)
test for classes with a __complex__() method.  The attribute is pulled
out of the instance with PyObject_GetAttr() but this transfers
ownership and the function object was never DECREF'd.

Python/bltinmodule.c

index d23026182e5d799197fd71992bb08fec1563c620..df6b98b42c401c572633f4bd1c16f33d969e888c 100644 (file)
@@ -409,6 +409,7 @@ builtin_complex(self, args)
                                return NULL;
                        r = PyEval_CallObject(f, args);
                        Py_DECREF(args);
+                       Py_DECREF(f);
                        if (r == NULL)
                                return NULL;
                        own_r = 1;