From: Kirill Podoprigora Date: Thu, 26 Sep 2024 15:30:21 +0000 (+0300) Subject: gh-124606: Fix reference leak in error path in `datetime_fromisoformat` in `_datetime... X-Git-Tag: v3.14.0a1~311 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c98fdab7d1167211c9d162c418e2b443a02867a;p=thirdparty%2FPython%2Fcpython.git gh-124606: Fix reference leak in error path in `datetime_fromisoformat` in `_datetimemodule.c` (#124607) Previously `tzdata` and `dtstr_clean` were not decrefed in the `invalid_iso_midnight` error path of the `datetime_isoformat` function. --- diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 0d91bef2ff9b..90527d2a3e03 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -5959,6 +5959,8 @@ datetime_fromisoformat(PyObject *cls, PyObject *dtstr) invalid_iso_midnight: PyErr_SetString(PyExc_ValueError, "minute, second, and microsecond must be 0 when hour is 24"); + Py_DECREF(tzinfo); + Py_DECREF(dtstr_clean); return NULL; invalid_string_error: