]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-90716: Fix pylong_int_from_string() refleak (#99094)
authorVictor Stinner <vstinner@python.org>
Fri, 4 Nov 2022 13:24:10 +0000 (14:24 +0100)
committerGitHub <noreply@github.com>
Fri, 4 Nov 2022 13:24:10 +0000 (14:24 +0100)
Fix validated by:

    $ ./python -m test -R 3:3 test_int
    Tests result: SUCCESS

Objects/longobject.c

index a87293899001ed4a3b20171a3ad5015d0bb0079d..652fdb7974b1c8c84145bf2dbbf3d6e83aedf582 100644 (file)
@@ -2376,6 +2376,7 @@ pylong_int_from_string(const char *start, const char *end, PyLongObject **res)
         goto error;
     }
     if (!PyLong_Check(result)) {
+        Py_DECREF(result);
         PyErr_SetString(PyExc_TypeError,
                         "_pylong.int_from_string did not return an int");
         goto error;