bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)
There was a missing PyMem_Free(format) in time_strftime().
(cherry picked from commit 91e6c8717b7dcbcc46b189509de5f2d335819f37)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index dbe2fba..7264ad6 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -776,6 +776,7 @@
if (outbuf[1] == L'y' && buf.tm_year < 0) {
PyErr_SetString(PyExc_ValueError,
"format %y requires year >= 1900 on AIX");
+ PyMem_Free(format);
return NULL;
}
}