Skip to content

Commit

Permalink
gh-124606: Fix reference leak in error path in `datetime_fromisoforma…
Browse files Browse the repository at this point in the history
…t` in `_datetimemodule.c` (#124607)

Previously `tzdata` and `dtstr_clean` were not decrefed in the `invalid_iso_midnight` error path of the `datetime_isoformat` function.
  • Loading branch information
Eclips4 authored Sep 26, 2024
1 parent 257a20a commit 9c98fda
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9c98fda

Please sign in to comment.