https://github.com/python/cpython/commit/3fe7849d9a50075901195602bb7143b93537289a
commit: 3fe7849d9a50075901195602bb7143b93537289a
branch: main
author: Pieter Eendebak <[email protected]>
committer: encukou <[email protected]>
date: 2026-03-04T14:21:10+01:00
summary:

gh-145376: Fix refleak in error path of time_tzset (GH-145477)

files:
M Modules/timemodule.c

diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 3946d18479e253..a3260e0f15ab99 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1170,7 +1170,8 @@ time_tzset(PyObject *self, PyObject *unused)
 
     /* Reset timezone, altzone, daylight and tzname */
     if (init_timezone(m) < 0) {
-         return NULL;
+        Py_DECREF(m);
+        return NULL;
     }
     Py_DECREF(m);
     if (PyErr_Occurred())

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to