]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PyLong_FromString(): Nailed a small memory leak. In the str==start
authorBarry Warsaw <barry@python.org>
Wed, 27 Jan 1999 17:48:27 +0000 (17:48 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 27 Jan 1999 17:48:27 +0000 (17:48 +0000)
test, we forgot that z is still pointing to a real live object.
DECREF() it before returning.

Objects/longobject.c

index 834b8a875213fc8a1e41ffebd2a8b74042137dbf..7c805a5259f6d817ce251a56dd90bc4ec30abeb8 100644 (file)
@@ -769,6 +769,7 @@ PyLong_FromString(str, pend, base)
        if (str == start) {
                PyErr_SetString(PyExc_ValueError,
                                "no digits in long int constant");
+               Py_DECREF(z);
                return NULL;
        }
        if (sign < 0 && z != NULL && z->ob_size != 0)