summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-04 13:24:10 (GMT)
committerGitHub <noreply@github.com>2022-11-04 13:24:10 (GMT)
commit387f72588d538bc56669f0f28cc41df854fc5b43 (patch)
treec24a2f3fddfc51d43c399d29b46f0895d0523d2b /Objects/longobject.c
parentc0bf7607a1c215cd92f2976c9e915b913fc149d1 (diff)
downloadcpython-387f72588d538bc56669f0f28cc41df854fc5b43.zip
cpython-387f72588d538bc56669f0f28cc41df854fc5b43.tar.gz
cpython-387f72588d538bc56669f0f28cc41df854fc5b43.tar.bz2
gh-90716: Fix pylong_int_from_string() refleak (#99094)
Fix validated by: $ ./python -m test -R 3:3 test_int Tests result: SUCCESS
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index a872938..652fdb7 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -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;